
kernel:     file format elf32-i386


Disassembly of section .text:

80100000 <multiboot_header>:
80100000:	02 b0 ad 1b 00 00    	add    0x1bad(%eax),%dh
80100006:	00 00                	add    %al,(%eax)
80100008:	fe 4f 52             	decb   0x52(%edi)
8010000b:	e4 0f                	in     $0xf,%al

8010000c <entry>:

# Entering xv6 on boot processor, with paging off.
.globl entry
entry:
  # Turn on page size extension for 4Mbyte pages
  movl    %cr4, %eax
8010000c:	0f 20 e0             	mov    %cr4,%eax
  orl     $(CR4_PSE), %eax
8010000f:	83 c8 10             	or     $0x10,%eax
  movl    %eax, %cr4
80100012:	0f 22 e0             	mov    %eax,%cr4
  # Set page directory
  movl    $(V2P_WO(entrypgdir)), %eax
80100015:	b8 00 a0 10 00       	mov    $0x10a000,%eax
  movl    %eax, %cr3
8010001a:	0f 22 d8             	mov    %eax,%cr3
  # Turn on paging.
  movl    %cr0, %eax
8010001d:	0f 20 c0             	mov    %cr0,%eax
  orl     $(CR0_PG|CR0_WP), %eax
80100020:	0d 00 00 01 80       	or     $0x80010000,%eax
  movl    %eax, %cr0
80100025:	0f 22 c0             	mov    %eax,%cr0

  # Set up the stack pointer.
  movl $(stack + KSTACKSIZE), %esp
80100028:	bc 90 c6 10 80       	mov    $0x8010c690,%esp

  # Jump to main(), and switch to executing at
  # high addresses. The indirect call is needed because
  # the assembler produces a PC-relative instruction
  # for a direct jump.
  mov $main, %eax
8010002d:	b8 5f 34 10 80       	mov    $0x8010345f,%eax
  jmp *%eax
80100032:	ff e0                	jmp    *%eax

80100034 <binit>:
  struct buf head;
} bcache;

void
binit(void)
{
80100034:	55                   	push   %ebp
80100035:	89 e5                	mov    %esp,%ebp
80100037:	83 ec 28             	sub    $0x28,%esp
  struct buf *b;

  initlock(&bcache.lock, "bcache");
8010003a:	c7 44 24 04 00 87 10 	movl   $0x80108700,0x4(%esp)
80100041:	80 
80100042:	c7 04 24 a0 c6 10 80 	movl   $0x8010c6a0,(%esp)
80100049:	e8 a8 4f 00 00       	call   80104ff6 <initlock>

//PAGEBREAK!
  // Create linked list of buffers
  bcache.head.prev = &bcache.head;
8010004e:	c7 05 d0 db 10 80 c4 	movl   $0x8010dbc4,0x8010dbd0
80100055:	db 10 80 
  bcache.head.next = &bcache.head;
80100058:	c7 05 d4 db 10 80 c4 	movl   $0x8010dbc4,0x8010dbd4
8010005f:	db 10 80 
  for(b = bcache.buf; b < bcache.buf+NBUF; b++){
80100062:	c7 45 f4 d4 c6 10 80 	movl   $0x8010c6d4,-0xc(%ebp)
80100069:	eb 3a                	jmp    801000a5 <binit+0x71>
    b->next = bcache.head.next;
8010006b:	8b 15 d4 db 10 80    	mov    0x8010dbd4,%edx
80100071:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100074:	89 50 10             	mov    %edx,0x10(%eax)
    b->prev = &bcache.head;
80100077:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010007a:	c7 40 0c c4 db 10 80 	movl   $0x8010dbc4,0xc(%eax)
    b->dev = -1;
80100081:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100084:	c7 40 04 ff ff ff ff 	movl   $0xffffffff,0x4(%eax)
    bcache.head.next->prev = b;
8010008b:	a1 d4 db 10 80       	mov    0x8010dbd4,%eax
80100090:	8b 55 f4             	mov    -0xc(%ebp),%edx
80100093:	89 50 0c             	mov    %edx,0xc(%eax)
    bcache.head.next = b;
80100096:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100099:	a3 d4 db 10 80       	mov    %eax,0x8010dbd4

//PAGEBREAK!
  // Create linked list of buffers
  bcache.head.prev = &bcache.head;
  bcache.head.next = &bcache.head;
  for(b = bcache.buf; b < bcache.buf+NBUF; b++){
8010009e:	81 45 f4 18 02 00 00 	addl   $0x218,-0xc(%ebp)
801000a5:	81 7d f4 c4 db 10 80 	cmpl   $0x8010dbc4,-0xc(%ebp)
801000ac:	72 bd                	jb     8010006b <binit+0x37>
    b->prev = &bcache.head;
    b->dev = -1;
    bcache.head.next->prev = b;
    bcache.head.next = b;
  }
}
801000ae:	c9                   	leave  
801000af:	c3                   	ret    

801000b0 <bget>:
// Look through buffer cache for sector on device dev.
// If not found, allocate fresh block.
// In either case, return B_BUSY buffer.
static struct buf*
bget(uint dev, uint sector)
{
801000b0:	55                   	push   %ebp
801000b1:	89 e5                	mov    %esp,%ebp
801000b3:	83 ec 28             	sub    $0x28,%esp
  struct buf *b;

  acquire(&bcache.lock);
801000b6:	c7 04 24 a0 c6 10 80 	movl   $0x8010c6a0,(%esp)
801000bd:	e8 55 4f 00 00       	call   80105017 <acquire>

 loop:
  // Is the sector already cached?
  for(b = bcache.head.next; b != &bcache.head; b = b->next){
801000c2:	a1 d4 db 10 80       	mov    0x8010dbd4,%eax
801000c7:	89 45 f4             	mov    %eax,-0xc(%ebp)
801000ca:	eb 63                	jmp    8010012f <bget+0x7f>
    if(b->dev == dev && b->sector == sector){
801000cc:	8b 45 f4             	mov    -0xc(%ebp),%eax
801000cf:	8b 40 04             	mov    0x4(%eax),%eax
801000d2:	3b 45 08             	cmp    0x8(%ebp),%eax
801000d5:	75 4f                	jne    80100126 <bget+0x76>
801000d7:	8b 45 f4             	mov    -0xc(%ebp),%eax
801000da:	8b 40 08             	mov    0x8(%eax),%eax
801000dd:	3b 45 0c             	cmp    0xc(%ebp),%eax
801000e0:	75 44                	jne    80100126 <bget+0x76>
      if(!(b->flags & B_BUSY)){
801000e2:	8b 45 f4             	mov    -0xc(%ebp),%eax
801000e5:	8b 00                	mov    (%eax),%eax
801000e7:	83 e0 01             	and    $0x1,%eax
801000ea:	85 c0                	test   %eax,%eax
801000ec:	75 23                	jne    80100111 <bget+0x61>
        b->flags |= B_BUSY;
801000ee:	8b 45 f4             	mov    -0xc(%ebp),%eax
801000f1:	8b 00                	mov    (%eax),%eax
801000f3:	89 c2                	mov    %eax,%edx
801000f5:	83 ca 01             	or     $0x1,%edx
801000f8:	8b 45 f4             	mov    -0xc(%ebp),%eax
801000fb:	89 10                	mov    %edx,(%eax)
        release(&bcache.lock);
801000fd:	c7 04 24 a0 c6 10 80 	movl   $0x8010c6a0,(%esp)
80100104:	e8 70 4f 00 00       	call   80105079 <release>
        return b;
80100109:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010010c:	e9 93 00 00 00       	jmp    801001a4 <bget+0xf4>
      }
      sleep(b, &bcache.lock);
80100111:	c7 44 24 04 a0 c6 10 	movl   $0x8010c6a0,0x4(%esp)
80100118:	80 
80100119:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010011c:	89 04 24             	mov    %eax,(%esp)
8010011f:	e8 1e 49 00 00       	call   80104a42 <sleep>
      goto loop;
80100124:	eb 9c                	jmp    801000c2 <bget+0x12>

  acquire(&bcache.lock);

 loop:
  // Is the sector already cached?
  for(b = bcache.head.next; b != &bcache.head; b = b->next){
80100126:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100129:	8b 40 10             	mov    0x10(%eax),%eax
8010012c:	89 45 f4             	mov    %eax,-0xc(%ebp)
8010012f:	81 7d f4 c4 db 10 80 	cmpl   $0x8010dbc4,-0xc(%ebp)
80100136:	75 94                	jne    801000cc <bget+0x1c>
      goto loop;
    }
  }

  // Not cached; recycle some non-busy and clean buffer.
  for(b = bcache.head.prev; b != &bcache.head; b = b->prev){
80100138:	a1 d0 db 10 80       	mov    0x8010dbd0,%eax
8010013d:	89 45 f4             	mov    %eax,-0xc(%ebp)
80100140:	eb 4d                	jmp    8010018f <bget+0xdf>
    if((b->flags & B_BUSY) == 0 && (b->flags & B_DIRTY) == 0){
80100142:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100145:	8b 00                	mov    (%eax),%eax
80100147:	83 e0 01             	and    $0x1,%eax
8010014a:	85 c0                	test   %eax,%eax
8010014c:	75 38                	jne    80100186 <bget+0xd6>
8010014e:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100151:	8b 00                	mov    (%eax),%eax
80100153:	83 e0 04             	and    $0x4,%eax
80100156:	85 c0                	test   %eax,%eax
80100158:	75 2c                	jne    80100186 <bget+0xd6>
      b->dev = dev;
8010015a:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010015d:	8b 55 08             	mov    0x8(%ebp),%edx
80100160:	89 50 04             	mov    %edx,0x4(%eax)
      b->sector = sector;
80100163:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100166:	8b 55 0c             	mov    0xc(%ebp),%edx
80100169:	89 50 08             	mov    %edx,0x8(%eax)
      b->flags = B_BUSY;
8010016c:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010016f:	c7 00 01 00 00 00    	movl   $0x1,(%eax)
      release(&bcache.lock);
80100175:	c7 04 24 a0 c6 10 80 	movl   $0x8010c6a0,(%esp)
8010017c:	e8 f8 4e 00 00       	call   80105079 <release>
      return b;
80100181:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100184:	eb 1e                	jmp    801001a4 <bget+0xf4>
      goto loop;
    }
  }

  // Not cached; recycle some non-busy and clean buffer.
  for(b = bcache.head.prev; b != &bcache.head; b = b->prev){
80100186:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100189:	8b 40 0c             	mov    0xc(%eax),%eax
8010018c:	89 45 f4             	mov    %eax,-0xc(%ebp)
8010018f:	81 7d f4 c4 db 10 80 	cmpl   $0x8010dbc4,-0xc(%ebp)
80100196:	75 aa                	jne    80100142 <bget+0x92>
      b->flags = B_BUSY;
      release(&bcache.lock);
      return b;
    }
  }
  panic("bget: no buffers");
80100198:	c7 04 24 07 87 10 80 	movl   $0x80108707,(%esp)
8010019f:	e8 a2 03 00 00       	call   80100546 <panic>
}
801001a4:	c9                   	leave  
801001a5:	c3                   	ret    

801001a6 <bread>:

// Return a B_BUSY buf with the contents of the indicated disk sector.
struct buf*
bread(uint dev, uint sector)
{
801001a6:	55                   	push   %ebp
801001a7:	89 e5                	mov    %esp,%ebp
801001a9:	83 ec 28             	sub    $0x28,%esp
  struct buf *b;

  b = bget(dev, sector);
801001ac:	8b 45 0c             	mov    0xc(%ebp),%eax
801001af:	89 44 24 04          	mov    %eax,0x4(%esp)
801001b3:	8b 45 08             	mov    0x8(%ebp),%eax
801001b6:	89 04 24             	mov    %eax,(%esp)
801001b9:	e8 f2 fe ff ff       	call   801000b0 <bget>
801001be:	89 45 f4             	mov    %eax,-0xc(%ebp)
  if(!(b->flags & B_VALID))
801001c1:	8b 45 f4             	mov    -0xc(%ebp),%eax
801001c4:	8b 00                	mov    (%eax),%eax
801001c6:	83 e0 02             	and    $0x2,%eax
801001c9:	85 c0                	test   %eax,%eax
801001cb:	75 0b                	jne    801001d8 <bread+0x32>
    iderw(b);
801001cd:	8b 45 f4             	mov    -0xc(%ebp),%eax
801001d0:	89 04 24             	mov    %eax,(%esp)
801001d3:	e8 28 26 00 00       	call   80102800 <iderw>
  return b;
801001d8:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
801001db:	c9                   	leave  
801001dc:	c3                   	ret    

801001dd <bwrite>:

// Write b's contents to disk.  Must be B_BUSY.
void
bwrite(struct buf *b)
{
801001dd:	55                   	push   %ebp
801001de:	89 e5                	mov    %esp,%ebp
801001e0:	83 ec 18             	sub    $0x18,%esp
  if((b->flags & B_BUSY) == 0)
801001e3:	8b 45 08             	mov    0x8(%ebp),%eax
801001e6:	8b 00                	mov    (%eax),%eax
801001e8:	83 e0 01             	and    $0x1,%eax
801001eb:	85 c0                	test   %eax,%eax
801001ed:	75 0c                	jne    801001fb <bwrite+0x1e>
    panic("bwrite");
801001ef:	c7 04 24 18 87 10 80 	movl   $0x80108718,(%esp)
801001f6:	e8 4b 03 00 00       	call   80100546 <panic>
  b->flags |= B_DIRTY;
801001fb:	8b 45 08             	mov    0x8(%ebp),%eax
801001fe:	8b 00                	mov    (%eax),%eax
80100200:	89 c2                	mov    %eax,%edx
80100202:	83 ca 04             	or     $0x4,%edx
80100205:	8b 45 08             	mov    0x8(%ebp),%eax
80100208:	89 10                	mov    %edx,(%eax)
  iderw(b);
8010020a:	8b 45 08             	mov    0x8(%ebp),%eax
8010020d:	89 04 24             	mov    %eax,(%esp)
80100210:	e8 eb 25 00 00       	call   80102800 <iderw>
}
80100215:	c9                   	leave  
80100216:	c3                   	ret    

80100217 <brelse>:

// Release a B_BUSY buffer.
// Move to the head of the MRU list.
void
brelse(struct buf *b)
{
80100217:	55                   	push   %ebp
80100218:	89 e5                	mov    %esp,%ebp
8010021a:	83 ec 18             	sub    $0x18,%esp
  if((b->flags & B_BUSY) == 0)
8010021d:	8b 45 08             	mov    0x8(%ebp),%eax
80100220:	8b 00                	mov    (%eax),%eax
80100222:	83 e0 01             	and    $0x1,%eax
80100225:	85 c0                	test   %eax,%eax
80100227:	75 0c                	jne    80100235 <brelse+0x1e>
    panic("brelse");
80100229:	c7 04 24 1f 87 10 80 	movl   $0x8010871f,(%esp)
80100230:	e8 11 03 00 00       	call   80100546 <panic>

  acquire(&bcache.lock);
80100235:	c7 04 24 a0 c6 10 80 	movl   $0x8010c6a0,(%esp)
8010023c:	e8 d6 4d 00 00       	call   80105017 <acquire>

  b->next->prev = b->prev;
80100241:	8b 45 08             	mov    0x8(%ebp),%eax
80100244:	8b 40 10             	mov    0x10(%eax),%eax
80100247:	8b 55 08             	mov    0x8(%ebp),%edx
8010024a:	8b 52 0c             	mov    0xc(%edx),%edx
8010024d:	89 50 0c             	mov    %edx,0xc(%eax)
  b->prev->next = b->next;
80100250:	8b 45 08             	mov    0x8(%ebp),%eax
80100253:	8b 40 0c             	mov    0xc(%eax),%eax
80100256:	8b 55 08             	mov    0x8(%ebp),%edx
80100259:	8b 52 10             	mov    0x10(%edx),%edx
8010025c:	89 50 10             	mov    %edx,0x10(%eax)
  b->next = bcache.head.next;
8010025f:	8b 15 d4 db 10 80    	mov    0x8010dbd4,%edx
80100265:	8b 45 08             	mov    0x8(%ebp),%eax
80100268:	89 50 10             	mov    %edx,0x10(%eax)
  b->prev = &bcache.head;
8010026b:	8b 45 08             	mov    0x8(%ebp),%eax
8010026e:	c7 40 0c c4 db 10 80 	movl   $0x8010dbc4,0xc(%eax)
  bcache.head.next->prev = b;
80100275:	a1 d4 db 10 80       	mov    0x8010dbd4,%eax
8010027a:	8b 55 08             	mov    0x8(%ebp),%edx
8010027d:	89 50 0c             	mov    %edx,0xc(%eax)
  bcache.head.next = b;
80100280:	8b 45 08             	mov    0x8(%ebp),%eax
80100283:	a3 d4 db 10 80       	mov    %eax,0x8010dbd4

  b->flags &= ~B_BUSY;
80100288:	8b 45 08             	mov    0x8(%ebp),%eax
8010028b:	8b 00                	mov    (%eax),%eax
8010028d:	89 c2                	mov    %eax,%edx
8010028f:	83 e2 fe             	and    $0xfffffffe,%edx
80100292:	8b 45 08             	mov    0x8(%ebp),%eax
80100295:	89 10                	mov    %edx,(%eax)
  wakeup(b);
80100297:	8b 45 08             	mov    0x8(%ebp),%eax
8010029a:	89 04 24             	mov    %eax,(%esp)
8010029d:	e8 7c 48 00 00       	call   80104b1e <wakeup>

  release(&bcache.lock);
801002a2:	c7 04 24 a0 c6 10 80 	movl   $0x8010c6a0,(%esp)
801002a9:	e8 cb 4d 00 00       	call   80105079 <release>
}
801002ae:	c9                   	leave  
801002af:	c3                   	ret    

801002b0 <inb>:
// Routines to let C code use special x86 instructions.

static inline uchar
inb(ushort port)
{
801002b0:	55                   	push   %ebp
801002b1:	89 e5                	mov    %esp,%ebp
801002b3:	53                   	push   %ebx
801002b4:	83 ec 14             	sub    $0x14,%esp
801002b7:	8b 45 08             	mov    0x8(%ebp),%eax
801002ba:	66 89 45 e8          	mov    %ax,-0x18(%ebp)
  uchar data;

  asm volatile("in %1,%0" : "=a" (data) : "d" (port));
801002be:	0f b7 55 e8          	movzwl -0x18(%ebp),%edx
801002c2:	66 89 55 ea          	mov    %dx,-0x16(%ebp)
801002c6:	0f b7 55 ea          	movzwl -0x16(%ebp),%edx
801002ca:	ec                   	in     (%dx),%al
801002cb:	89 c3                	mov    %eax,%ebx
801002cd:	88 5d fb             	mov    %bl,-0x5(%ebp)
  return data;
801002d0:	0f b6 45 fb          	movzbl -0x5(%ebp),%eax
}
801002d4:	83 c4 14             	add    $0x14,%esp
801002d7:	5b                   	pop    %ebx
801002d8:	5d                   	pop    %ebp
801002d9:	c3                   	ret    

801002da <outb>:
               "memory", "cc");
}

static inline void
outb(ushort port, uchar data)
{
801002da:	55                   	push   %ebp
801002db:	89 e5                	mov    %esp,%ebp
801002dd:	83 ec 08             	sub    $0x8,%esp
801002e0:	8b 55 08             	mov    0x8(%ebp),%edx
801002e3:	8b 45 0c             	mov    0xc(%ebp),%eax
801002e6:	66 89 55 fc          	mov    %dx,-0x4(%ebp)
801002ea:	88 45 f8             	mov    %al,-0x8(%ebp)
  asm volatile("out %0,%1" : : "a" (data), "d" (port));
801002ed:	0f b6 45 f8          	movzbl -0x8(%ebp),%eax
801002f1:	0f b7 55 fc          	movzwl -0x4(%ebp),%edx
801002f5:	ee                   	out    %al,(%dx)
}
801002f6:	c9                   	leave  
801002f7:	c3                   	ret    

801002f8 <cli>:
  asm volatile("movw %0, %%gs" : : "r" (v));
}

static inline void
cli(void)
{
801002f8:	55                   	push   %ebp
801002f9:	89 e5                	mov    %esp,%ebp
  asm volatile("cli");
801002fb:	fa                   	cli    
}
801002fc:	5d                   	pop    %ebp
801002fd:	c3                   	ret    

801002fe <printint>:
  int locking;
} cons;

static void
printint(int xx, int base, int sign)
{
801002fe:	55                   	push   %ebp
801002ff:	89 e5                	mov    %esp,%ebp
80100301:	83 ec 48             	sub    $0x48,%esp
  static char digits[] = "0123456789abcdef";
  char buf[16];
  int i;
  uint x;

  if(sign && (sign = xx < 0))
80100304:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
80100308:	74 1c                	je     80100326 <printint+0x28>
8010030a:	8b 45 08             	mov    0x8(%ebp),%eax
8010030d:	c1 e8 1f             	shr    $0x1f,%eax
80100310:	0f b6 c0             	movzbl %al,%eax
80100313:	89 45 10             	mov    %eax,0x10(%ebp)
80100316:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
8010031a:	74 0a                	je     80100326 <printint+0x28>
    x = -xx;
8010031c:	8b 45 08             	mov    0x8(%ebp),%eax
8010031f:	f7 d8                	neg    %eax
80100321:	89 45 f0             	mov    %eax,-0x10(%ebp)
80100324:	eb 06                	jmp    8010032c <printint+0x2e>
  else
    x = xx;
80100326:	8b 45 08             	mov    0x8(%ebp),%eax
80100329:	89 45 f0             	mov    %eax,-0x10(%ebp)

  i = 0;
8010032c:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
  do{
    buf[i++] = digits[x % base];
80100333:	8b 4d 0c             	mov    0xc(%ebp),%ecx
80100336:	8b 45 f0             	mov    -0x10(%ebp),%eax
80100339:	ba 00 00 00 00       	mov    $0x0,%edx
8010033e:	f7 f1                	div    %ecx
80100340:	89 d0                	mov    %edx,%eax
80100342:	0f b6 80 04 90 10 80 	movzbl -0x7fef6ffc(%eax),%eax
80100349:	8d 4d e0             	lea    -0x20(%ebp),%ecx
8010034c:	8b 55 f4             	mov    -0xc(%ebp),%edx
8010034f:	01 ca                	add    %ecx,%edx
80100351:	88 02                	mov    %al,(%edx)
80100353:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
  }while((x /= base) != 0);
80100357:	8b 55 0c             	mov    0xc(%ebp),%edx
8010035a:	89 55 d4             	mov    %edx,-0x2c(%ebp)
8010035d:	8b 45 f0             	mov    -0x10(%ebp),%eax
80100360:	ba 00 00 00 00       	mov    $0x0,%edx
80100365:	f7 75 d4             	divl   -0x2c(%ebp)
80100368:	89 45 f0             	mov    %eax,-0x10(%ebp)
8010036b:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
8010036f:	75 c2                	jne    80100333 <printint+0x35>

  if(sign)
80100371:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
80100375:	74 27                	je     8010039e <printint+0xa0>
    buf[i++] = '-';
80100377:	8d 55 e0             	lea    -0x20(%ebp),%edx
8010037a:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010037d:	01 d0                	add    %edx,%eax
8010037f:	c6 00 2d             	movb   $0x2d,(%eax)
80100382:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)

  while(--i >= 0)
80100386:	eb 16                	jmp    8010039e <printint+0xa0>
    consputc(buf[i]);
80100388:	8d 55 e0             	lea    -0x20(%ebp),%edx
8010038b:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010038e:	01 d0                	add    %edx,%eax
80100390:	0f b6 00             	movzbl (%eax),%eax
80100393:	0f be c0             	movsbl %al,%eax
80100396:	89 04 24             	mov    %eax,(%esp)
80100399:	e8 bb 03 00 00       	call   80100759 <consputc>
  }while((x /= base) != 0);

  if(sign)
    buf[i++] = '-';

  while(--i >= 0)
8010039e:	83 6d f4 01          	subl   $0x1,-0xc(%ebp)
801003a2:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
801003a6:	79 e0                	jns    80100388 <printint+0x8a>
    consputc(buf[i]);
}
801003a8:	c9                   	leave  
801003a9:	c3                   	ret    

801003aa <cprintf>:
//PAGEBREAK: 50

// Print to the console. only understands %d, %x, %p, %s.
void
cprintf(char *fmt, ...)
{
801003aa:	55                   	push   %ebp
801003ab:	89 e5                	mov    %esp,%ebp
801003ad:	83 ec 38             	sub    $0x38,%esp
  int i, c, locking;
  uint *argp;
  char *s;

  locking = cons.locking;
801003b0:	a1 34 b6 10 80       	mov    0x8010b634,%eax
801003b5:	89 45 e8             	mov    %eax,-0x18(%ebp)
  if(locking)
801003b8:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
801003bc:	74 0c                	je     801003ca <cprintf+0x20>
    acquire(&cons.lock);
801003be:	c7 04 24 00 b6 10 80 	movl   $0x8010b600,(%esp)
801003c5:	e8 4d 4c 00 00       	call   80105017 <acquire>

  if (fmt == 0)
801003ca:	8b 45 08             	mov    0x8(%ebp),%eax
801003cd:	85 c0                	test   %eax,%eax
801003cf:	75 0c                	jne    801003dd <cprintf+0x33>
    panic("null fmt");
801003d1:	c7 04 24 26 87 10 80 	movl   $0x80108726,(%esp)
801003d8:	e8 69 01 00 00       	call   80100546 <panic>

  argp = (uint*)(void*)(&fmt + 1);
801003dd:	8d 45 0c             	lea    0xc(%ebp),%eax
801003e0:	89 45 f0             	mov    %eax,-0x10(%ebp)
  for(i = 0; (c = fmt[i] & 0xff) != 0; i++){
801003e3:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
801003ea:	e9 20 01 00 00       	jmp    8010050f <cprintf+0x165>
    if(c != '%'){
801003ef:	83 7d e4 25          	cmpl   $0x25,-0x1c(%ebp)
801003f3:	74 10                	je     80100405 <cprintf+0x5b>
      consputc(c);
801003f5:	8b 45 e4             	mov    -0x1c(%ebp),%eax
801003f8:	89 04 24             	mov    %eax,(%esp)
801003fb:	e8 59 03 00 00       	call   80100759 <consputc>
      continue;
80100400:	e9 06 01 00 00       	jmp    8010050b <cprintf+0x161>
    }
    c = fmt[++i] & 0xff;
80100405:	8b 55 08             	mov    0x8(%ebp),%edx
80100408:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
8010040c:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010040f:	01 d0                	add    %edx,%eax
80100411:	0f b6 00             	movzbl (%eax),%eax
80100414:	0f be c0             	movsbl %al,%eax
80100417:	25 ff 00 00 00       	and    $0xff,%eax
8010041c:	89 45 e4             	mov    %eax,-0x1c(%ebp)
    if(c == 0)
8010041f:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
80100423:	0f 84 08 01 00 00    	je     80100531 <cprintf+0x187>
      break;
    switch(c){
80100429:	8b 45 e4             	mov    -0x1c(%ebp),%eax
8010042c:	83 f8 70             	cmp    $0x70,%eax
8010042f:	74 4d                	je     8010047e <cprintf+0xd4>
80100431:	83 f8 70             	cmp    $0x70,%eax
80100434:	7f 13                	jg     80100449 <cprintf+0x9f>
80100436:	83 f8 25             	cmp    $0x25,%eax
80100439:	0f 84 a6 00 00 00    	je     801004e5 <cprintf+0x13b>
8010043f:	83 f8 64             	cmp    $0x64,%eax
80100442:	74 14                	je     80100458 <cprintf+0xae>
80100444:	e9 aa 00 00 00       	jmp    801004f3 <cprintf+0x149>
80100449:	83 f8 73             	cmp    $0x73,%eax
8010044c:	74 53                	je     801004a1 <cprintf+0xf7>
8010044e:	83 f8 78             	cmp    $0x78,%eax
80100451:	74 2b                	je     8010047e <cprintf+0xd4>
80100453:	e9 9b 00 00 00       	jmp    801004f3 <cprintf+0x149>
    case 'd':
      printint(*argp++, 10, 1);
80100458:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010045b:	8b 00                	mov    (%eax),%eax
8010045d:	83 45 f0 04          	addl   $0x4,-0x10(%ebp)
80100461:	c7 44 24 08 01 00 00 	movl   $0x1,0x8(%esp)
80100468:	00 
80100469:	c7 44 24 04 0a 00 00 	movl   $0xa,0x4(%esp)
80100470:	00 
80100471:	89 04 24             	mov    %eax,(%esp)
80100474:	e8 85 fe ff ff       	call   801002fe <printint>
      break;
80100479:	e9 8d 00 00 00       	jmp    8010050b <cprintf+0x161>
    case 'x':
    case 'p':
      printint(*argp++, 16, 0);
8010047e:	8b 45 f0             	mov    -0x10(%ebp),%eax
80100481:	8b 00                	mov    (%eax),%eax
80100483:	83 45 f0 04          	addl   $0x4,-0x10(%ebp)
80100487:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
8010048e:	00 
8010048f:	c7 44 24 04 10 00 00 	movl   $0x10,0x4(%esp)
80100496:	00 
80100497:	89 04 24             	mov    %eax,(%esp)
8010049a:	e8 5f fe ff ff       	call   801002fe <printint>
      break;
8010049f:	eb 6a                	jmp    8010050b <cprintf+0x161>
    case 's':
      if((s = (char*)*argp++) == 0)
801004a1:	8b 45 f0             	mov    -0x10(%ebp),%eax
801004a4:	8b 00                	mov    (%eax),%eax
801004a6:	89 45 ec             	mov    %eax,-0x14(%ebp)
801004a9:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
801004ad:	0f 94 c0             	sete   %al
801004b0:	83 45 f0 04          	addl   $0x4,-0x10(%ebp)
801004b4:	84 c0                	test   %al,%al
801004b6:	74 20                	je     801004d8 <cprintf+0x12e>
        s = "(null)";
801004b8:	c7 45 ec 2f 87 10 80 	movl   $0x8010872f,-0x14(%ebp)
      for(; *s; s++)
801004bf:	eb 17                	jmp    801004d8 <cprintf+0x12e>
        consputc(*s);
801004c1:	8b 45 ec             	mov    -0x14(%ebp),%eax
801004c4:	0f b6 00             	movzbl (%eax),%eax
801004c7:	0f be c0             	movsbl %al,%eax
801004ca:	89 04 24             	mov    %eax,(%esp)
801004cd:	e8 87 02 00 00       	call   80100759 <consputc>
      printint(*argp++, 16, 0);
      break;
    case 's':
      if((s = (char*)*argp++) == 0)
        s = "(null)";
      for(; *s; s++)
801004d2:	83 45 ec 01          	addl   $0x1,-0x14(%ebp)
801004d6:	eb 01                	jmp    801004d9 <cprintf+0x12f>
801004d8:	90                   	nop
801004d9:	8b 45 ec             	mov    -0x14(%ebp),%eax
801004dc:	0f b6 00             	movzbl (%eax),%eax
801004df:	84 c0                	test   %al,%al
801004e1:	75 de                	jne    801004c1 <cprintf+0x117>
        consputc(*s);
      break;
801004e3:	eb 26                	jmp    8010050b <cprintf+0x161>
    case '%':
      consputc('%');
801004e5:	c7 04 24 25 00 00 00 	movl   $0x25,(%esp)
801004ec:	e8 68 02 00 00       	call   80100759 <consputc>
      break;
801004f1:	eb 18                	jmp    8010050b <cprintf+0x161>
    default:
      // Print unknown % sequence to draw attention.
      consputc('%');
801004f3:	c7 04 24 25 00 00 00 	movl   $0x25,(%esp)
801004fa:	e8 5a 02 00 00       	call   80100759 <consputc>
      consputc(c);
801004ff:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80100502:	89 04 24             	mov    %eax,(%esp)
80100505:	e8 4f 02 00 00       	call   80100759 <consputc>
      break;
8010050a:	90                   	nop

  if (fmt == 0)
    panic("null fmt");

  argp = (uint*)(void*)(&fmt + 1);
  for(i = 0; (c = fmt[i] & 0xff) != 0; i++){
8010050b:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
8010050f:	8b 55 08             	mov    0x8(%ebp),%edx
80100512:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100515:	01 d0                	add    %edx,%eax
80100517:	0f b6 00             	movzbl (%eax),%eax
8010051a:	0f be c0             	movsbl %al,%eax
8010051d:	25 ff 00 00 00       	and    $0xff,%eax
80100522:	89 45 e4             	mov    %eax,-0x1c(%ebp)
80100525:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
80100529:	0f 85 c0 fe ff ff    	jne    801003ef <cprintf+0x45>
8010052f:	eb 01                	jmp    80100532 <cprintf+0x188>
      consputc(c);
      continue;
    }
    c = fmt[++i] & 0xff;
    if(c == 0)
      break;
80100531:	90                   	nop
      consputc(c);
      break;
    }
  }

  if(locking)
80100532:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
80100536:	74 0c                	je     80100544 <cprintf+0x19a>
    release(&cons.lock);
80100538:	c7 04 24 00 b6 10 80 	movl   $0x8010b600,(%esp)
8010053f:	e8 35 4b 00 00       	call   80105079 <release>
}
80100544:	c9                   	leave  
80100545:	c3                   	ret    

80100546 <panic>:

void
panic(char *s)
{
80100546:	55                   	push   %ebp
80100547:	89 e5                	mov    %esp,%ebp
80100549:	83 ec 48             	sub    $0x48,%esp
  int i;
  uint pcs[10];
  
  cli();
8010054c:	e8 a7 fd ff ff       	call   801002f8 <cli>
  cons.locking = 0;
80100551:	c7 05 34 b6 10 80 00 	movl   $0x0,0x8010b634
80100558:	00 00 00 
  cprintf("cpu%d: panic: ", cpu->id);
8010055b:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
80100561:	0f b6 00             	movzbl (%eax),%eax
80100564:	0f b6 c0             	movzbl %al,%eax
80100567:	89 44 24 04          	mov    %eax,0x4(%esp)
8010056b:	c7 04 24 36 87 10 80 	movl   $0x80108736,(%esp)
80100572:	e8 33 fe ff ff       	call   801003aa <cprintf>
  cprintf(s);
80100577:	8b 45 08             	mov    0x8(%ebp),%eax
8010057a:	89 04 24             	mov    %eax,(%esp)
8010057d:	e8 28 fe ff ff       	call   801003aa <cprintf>
  cprintf("\n");
80100582:	c7 04 24 45 87 10 80 	movl   $0x80108745,(%esp)
80100589:	e8 1c fe ff ff       	call   801003aa <cprintf>
  getcallerpcs(&s, pcs);
8010058e:	8d 45 cc             	lea    -0x34(%ebp),%eax
80100591:	89 44 24 04          	mov    %eax,0x4(%esp)
80100595:	8d 45 08             	lea    0x8(%ebp),%eax
80100598:	89 04 24             	mov    %eax,(%esp)
8010059b:	e8 28 4b 00 00       	call   801050c8 <getcallerpcs>
  for(i=0; i<10; i++)
801005a0:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
801005a7:	eb 1b                	jmp    801005c4 <panic+0x7e>
    cprintf(" %p", pcs[i]);
801005a9:	8b 45 f4             	mov    -0xc(%ebp),%eax
801005ac:	8b 44 85 cc          	mov    -0x34(%ebp,%eax,4),%eax
801005b0:	89 44 24 04          	mov    %eax,0x4(%esp)
801005b4:	c7 04 24 47 87 10 80 	movl   $0x80108747,(%esp)
801005bb:	e8 ea fd ff ff       	call   801003aa <cprintf>
  cons.locking = 0;
  cprintf("cpu%d: panic: ", cpu->id);
  cprintf(s);
  cprintf("\n");
  getcallerpcs(&s, pcs);
  for(i=0; i<10; i++)
801005c0:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
801005c4:	83 7d f4 09          	cmpl   $0x9,-0xc(%ebp)
801005c8:	7e df                	jle    801005a9 <panic+0x63>
    cprintf(" %p", pcs[i]);
  panicked = 1; // freeze other CPU
801005ca:	c7 05 e0 b5 10 80 01 	movl   $0x1,0x8010b5e0
801005d1:	00 00 00 
  for(;;)
    ;
801005d4:	eb fe                	jmp    801005d4 <panic+0x8e>

801005d6 <cgaputc>:
#define CRTPORT 0x3d4
static ushort *crt = (ushort*)P2V(0xb8000);  // CGA memory

static void
cgaputc(int c)
{
801005d6:	55                   	push   %ebp
801005d7:	89 e5                	mov    %esp,%ebp
801005d9:	83 ec 28             	sub    $0x28,%esp
  int pos;
  
  // Cursor position: col + 80*row.
  outb(CRTPORT, 14);
801005dc:	c7 44 24 04 0e 00 00 	movl   $0xe,0x4(%esp)
801005e3:	00 
801005e4:	c7 04 24 d4 03 00 00 	movl   $0x3d4,(%esp)
801005eb:	e8 ea fc ff ff       	call   801002da <outb>
  pos = inb(CRTPORT+1) << 8;
801005f0:	c7 04 24 d5 03 00 00 	movl   $0x3d5,(%esp)
801005f7:	e8 b4 fc ff ff       	call   801002b0 <inb>
801005fc:	0f b6 c0             	movzbl %al,%eax
801005ff:	c1 e0 08             	shl    $0x8,%eax
80100602:	89 45 f4             	mov    %eax,-0xc(%ebp)
  outb(CRTPORT, 15);
80100605:	c7 44 24 04 0f 00 00 	movl   $0xf,0x4(%esp)
8010060c:	00 
8010060d:	c7 04 24 d4 03 00 00 	movl   $0x3d4,(%esp)
80100614:	e8 c1 fc ff ff       	call   801002da <outb>
  pos |= inb(CRTPORT+1);
80100619:	c7 04 24 d5 03 00 00 	movl   $0x3d5,(%esp)
80100620:	e8 8b fc ff ff       	call   801002b0 <inb>
80100625:	0f b6 c0             	movzbl %al,%eax
80100628:	09 45 f4             	or     %eax,-0xc(%ebp)

  if(c == '\n')
8010062b:	83 7d 08 0a          	cmpl   $0xa,0x8(%ebp)
8010062f:	75 30                	jne    80100661 <cgaputc+0x8b>
    pos += 80 - pos%80;
80100631:	8b 4d f4             	mov    -0xc(%ebp),%ecx
80100634:	ba 67 66 66 66       	mov    $0x66666667,%edx
80100639:	89 c8                	mov    %ecx,%eax
8010063b:	f7 ea                	imul   %edx
8010063d:	c1 fa 05             	sar    $0x5,%edx
80100640:	89 c8                	mov    %ecx,%eax
80100642:	c1 f8 1f             	sar    $0x1f,%eax
80100645:	29 c2                	sub    %eax,%edx
80100647:	89 d0                	mov    %edx,%eax
80100649:	c1 e0 02             	shl    $0x2,%eax
8010064c:	01 d0                	add    %edx,%eax
8010064e:	c1 e0 04             	shl    $0x4,%eax
80100651:	89 ca                	mov    %ecx,%edx
80100653:	29 c2                	sub    %eax,%edx
80100655:	b8 50 00 00 00       	mov    $0x50,%eax
8010065a:	29 d0                	sub    %edx,%eax
8010065c:	01 45 f4             	add    %eax,-0xc(%ebp)
8010065f:	eb 32                	jmp    80100693 <cgaputc+0xbd>
  else if(c == BACKSPACE){
80100661:	81 7d 08 00 01 00 00 	cmpl   $0x100,0x8(%ebp)
80100668:	75 0c                	jne    80100676 <cgaputc+0xa0>
    if(pos > 0) --pos;
8010066a:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
8010066e:	7e 23                	jle    80100693 <cgaputc+0xbd>
80100670:	83 6d f4 01          	subl   $0x1,-0xc(%ebp)
80100674:	eb 1d                	jmp    80100693 <cgaputc+0xbd>
  } else
    crt[pos++] = (c&0xff) | 0x0700;  // black on white
80100676:	a1 00 90 10 80       	mov    0x80109000,%eax
8010067b:	8b 55 f4             	mov    -0xc(%ebp),%edx
8010067e:	01 d2                	add    %edx,%edx
80100680:	01 c2                	add    %eax,%edx
80100682:	8b 45 08             	mov    0x8(%ebp),%eax
80100685:	66 25 ff 00          	and    $0xff,%ax
80100689:	80 cc 07             	or     $0x7,%ah
8010068c:	66 89 02             	mov    %ax,(%edx)
8010068f:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
  
  if((pos/80) >= 24){  // Scroll up.
80100693:	81 7d f4 7f 07 00 00 	cmpl   $0x77f,-0xc(%ebp)
8010069a:	7e 53                	jle    801006ef <cgaputc+0x119>
    memmove(crt, crt+80, sizeof(crt[0])*23*80);
8010069c:	a1 00 90 10 80       	mov    0x80109000,%eax
801006a1:	8d 90 a0 00 00 00    	lea    0xa0(%eax),%edx
801006a7:	a1 00 90 10 80       	mov    0x80109000,%eax
801006ac:	c7 44 24 08 60 0e 00 	movl   $0xe60,0x8(%esp)
801006b3:	00 
801006b4:	89 54 24 04          	mov    %edx,0x4(%esp)
801006b8:	89 04 24             	mov    %eax,(%esp)
801006bb:	e8 85 4c 00 00       	call   80105345 <memmove>
    pos -= 80;
801006c0:	83 6d f4 50          	subl   $0x50,-0xc(%ebp)
    memset(crt+pos, 0, sizeof(crt[0])*(24*80 - pos));
801006c4:	b8 80 07 00 00       	mov    $0x780,%eax
801006c9:	2b 45 f4             	sub    -0xc(%ebp),%eax
801006cc:	01 c0                	add    %eax,%eax
801006ce:	8b 15 00 90 10 80    	mov    0x80109000,%edx
801006d4:	8b 4d f4             	mov    -0xc(%ebp),%ecx
801006d7:	01 c9                	add    %ecx,%ecx
801006d9:	01 ca                	add    %ecx,%edx
801006db:	89 44 24 08          	mov    %eax,0x8(%esp)
801006df:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
801006e6:	00 
801006e7:	89 14 24             	mov    %edx,(%esp)
801006ea:	e8 83 4b 00 00       	call   80105272 <memset>
  }
  
  outb(CRTPORT, 14);
801006ef:	c7 44 24 04 0e 00 00 	movl   $0xe,0x4(%esp)
801006f6:	00 
801006f7:	c7 04 24 d4 03 00 00 	movl   $0x3d4,(%esp)
801006fe:	e8 d7 fb ff ff       	call   801002da <outb>
  outb(CRTPORT+1, pos>>8);
80100703:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100706:	c1 f8 08             	sar    $0x8,%eax
80100709:	0f b6 c0             	movzbl %al,%eax
8010070c:	89 44 24 04          	mov    %eax,0x4(%esp)
80100710:	c7 04 24 d5 03 00 00 	movl   $0x3d5,(%esp)
80100717:	e8 be fb ff ff       	call   801002da <outb>
  outb(CRTPORT, 15);
8010071c:	c7 44 24 04 0f 00 00 	movl   $0xf,0x4(%esp)
80100723:	00 
80100724:	c7 04 24 d4 03 00 00 	movl   $0x3d4,(%esp)
8010072b:	e8 aa fb ff ff       	call   801002da <outb>
  outb(CRTPORT+1, pos);
80100730:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100733:	0f b6 c0             	movzbl %al,%eax
80100736:	89 44 24 04          	mov    %eax,0x4(%esp)
8010073a:	c7 04 24 d5 03 00 00 	movl   $0x3d5,(%esp)
80100741:	e8 94 fb ff ff       	call   801002da <outb>
  crt[pos] = ' ' | 0x0700;
80100746:	a1 00 90 10 80       	mov    0x80109000,%eax
8010074b:	8b 55 f4             	mov    -0xc(%ebp),%edx
8010074e:	01 d2                	add    %edx,%edx
80100750:	01 d0                	add    %edx,%eax
80100752:	66 c7 00 20 07       	movw   $0x720,(%eax)
}
80100757:	c9                   	leave  
80100758:	c3                   	ret    

80100759 <consputc>:

void
consputc(int c)
{
80100759:	55                   	push   %ebp
8010075a:	89 e5                	mov    %esp,%ebp
8010075c:	83 ec 18             	sub    $0x18,%esp
  if(panicked){
8010075f:	a1 e0 b5 10 80       	mov    0x8010b5e0,%eax
80100764:	85 c0                	test   %eax,%eax
80100766:	74 07                	je     8010076f <consputc+0x16>
    cli();
80100768:	e8 8b fb ff ff       	call   801002f8 <cli>
    for(;;)
      ;
8010076d:	eb fe                	jmp    8010076d <consputc+0x14>
  }

  if(c == BACKSPACE){
8010076f:	81 7d 08 00 01 00 00 	cmpl   $0x100,0x8(%ebp)
80100776:	75 26                	jne    8010079e <consputc+0x45>
    uartputc('\b'); uartputc(' '); uartputc('\b');
80100778:	c7 04 24 08 00 00 00 	movl   $0x8,(%esp)
8010077f:	e8 c9 65 00 00       	call   80106d4d <uartputc>
80100784:	c7 04 24 20 00 00 00 	movl   $0x20,(%esp)
8010078b:	e8 bd 65 00 00       	call   80106d4d <uartputc>
80100790:	c7 04 24 08 00 00 00 	movl   $0x8,(%esp)
80100797:	e8 b1 65 00 00       	call   80106d4d <uartputc>
8010079c:	eb 0b                	jmp    801007a9 <consputc+0x50>
  } else
    uartputc(c);
8010079e:	8b 45 08             	mov    0x8(%ebp),%eax
801007a1:	89 04 24             	mov    %eax,(%esp)
801007a4:	e8 a4 65 00 00       	call   80106d4d <uartputc>
  cgaputc(c);
801007a9:	8b 45 08             	mov    0x8(%ebp),%eax
801007ac:	89 04 24             	mov    %eax,(%esp)
801007af:	e8 22 fe ff ff       	call   801005d6 <cgaputc>
}
801007b4:	c9                   	leave  
801007b5:	c3                   	ret    

801007b6 <consoleintr>:

#define C(x)  ((x)-'@')  // Control-x

void
consoleintr(int (*getc)(void))
{
801007b6:	55                   	push   %ebp
801007b7:	89 e5                	mov    %esp,%ebp
801007b9:	83 ec 28             	sub    $0x28,%esp
  int c;

  acquire(&input.lock);
801007bc:	c7 04 24 e0 dd 10 80 	movl   $0x8010dde0,(%esp)
801007c3:	e8 4f 48 00 00       	call   80105017 <acquire>
  while((c = getc()) >= 0){
801007c8:	e9 41 01 00 00       	jmp    8010090e <consoleintr+0x158>
    switch(c){
801007cd:	8b 45 f4             	mov    -0xc(%ebp),%eax
801007d0:	83 f8 10             	cmp    $0x10,%eax
801007d3:	74 1e                	je     801007f3 <consoleintr+0x3d>
801007d5:	83 f8 10             	cmp    $0x10,%eax
801007d8:	7f 0a                	jg     801007e4 <consoleintr+0x2e>
801007da:	83 f8 08             	cmp    $0x8,%eax
801007dd:	74 68                	je     80100847 <consoleintr+0x91>
801007df:	e9 94 00 00 00       	jmp    80100878 <consoleintr+0xc2>
801007e4:	83 f8 15             	cmp    $0x15,%eax
801007e7:	74 2f                	je     80100818 <consoleintr+0x62>
801007e9:	83 f8 7f             	cmp    $0x7f,%eax
801007ec:	74 59                	je     80100847 <consoleintr+0x91>
801007ee:	e9 85 00 00 00       	jmp    80100878 <consoleintr+0xc2>
    case C('P'):  // Process listing.
      procdump();
801007f3:	e8 cc 43 00 00       	call   80104bc4 <procdump>
      break;
801007f8:	e9 11 01 00 00       	jmp    8010090e <consoleintr+0x158>
    case C('U'):  // Kill line.
      while(input.e != input.w &&
            input.buf[(input.e-1) % INPUT_BUF] != '\n'){
        input.e--;
801007fd:	a1 9c de 10 80       	mov    0x8010de9c,%eax
80100802:	83 e8 01             	sub    $0x1,%eax
80100805:	a3 9c de 10 80       	mov    %eax,0x8010de9c
        consputc(BACKSPACE);
8010080a:	c7 04 24 00 01 00 00 	movl   $0x100,(%esp)
80100811:	e8 43 ff ff ff       	call   80100759 <consputc>
80100816:	eb 01                	jmp    80100819 <consoleintr+0x63>
    switch(c){
    case C('P'):  // Process listing.
      procdump();
      break;
    case C('U'):  // Kill line.
      while(input.e != input.w &&
80100818:	90                   	nop
80100819:	8b 15 9c de 10 80    	mov    0x8010de9c,%edx
8010081f:	a1 98 de 10 80       	mov    0x8010de98,%eax
80100824:	39 c2                	cmp    %eax,%edx
80100826:	0f 84 db 00 00 00    	je     80100907 <consoleintr+0x151>
            input.buf[(input.e-1) % INPUT_BUF] != '\n'){
8010082c:	a1 9c de 10 80       	mov    0x8010de9c,%eax
80100831:	83 e8 01             	sub    $0x1,%eax
80100834:	83 e0 7f             	and    $0x7f,%eax
80100837:	0f b6 80 14 de 10 80 	movzbl -0x7fef21ec(%eax),%eax
    switch(c){
    case C('P'):  // Process listing.
      procdump();
      break;
    case C('U'):  // Kill line.
      while(input.e != input.w &&
8010083e:	3c 0a                	cmp    $0xa,%al
80100840:	75 bb                	jne    801007fd <consoleintr+0x47>
            input.buf[(input.e-1) % INPUT_BUF] != '\n'){
        input.e--;
        consputc(BACKSPACE);
      }
      break;
80100842:	e9 c0 00 00 00       	jmp    80100907 <consoleintr+0x151>
    case C('H'): case '\x7f':  // Backspace
      if(input.e != input.w){
80100847:	8b 15 9c de 10 80    	mov    0x8010de9c,%edx
8010084d:	a1 98 de 10 80       	mov    0x8010de98,%eax
80100852:	39 c2                	cmp    %eax,%edx
80100854:	0f 84 b0 00 00 00    	je     8010090a <consoleintr+0x154>
        input.e--;
8010085a:	a1 9c de 10 80       	mov    0x8010de9c,%eax
8010085f:	83 e8 01             	sub    $0x1,%eax
80100862:	a3 9c de 10 80       	mov    %eax,0x8010de9c
        consputc(BACKSPACE);
80100867:	c7 04 24 00 01 00 00 	movl   $0x100,(%esp)
8010086e:	e8 e6 fe ff ff       	call   80100759 <consputc>
      }
      break;
80100873:	e9 92 00 00 00       	jmp    8010090a <consoleintr+0x154>
    default:
      if(c != 0 && input.e-input.r < INPUT_BUF){
80100878:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
8010087c:	0f 84 8b 00 00 00    	je     8010090d <consoleintr+0x157>
80100882:	8b 15 9c de 10 80    	mov    0x8010de9c,%edx
80100888:	a1 94 de 10 80       	mov    0x8010de94,%eax
8010088d:	89 d1                	mov    %edx,%ecx
8010088f:	29 c1                	sub    %eax,%ecx
80100891:	89 c8                	mov    %ecx,%eax
80100893:	83 f8 7f             	cmp    $0x7f,%eax
80100896:	77 75                	ja     8010090d <consoleintr+0x157>
        c = (c == '\r') ? '\n' : c;
80100898:	83 7d f4 0d          	cmpl   $0xd,-0xc(%ebp)
8010089c:	74 05                	je     801008a3 <consoleintr+0xed>
8010089e:	8b 45 f4             	mov    -0xc(%ebp),%eax
801008a1:	eb 05                	jmp    801008a8 <consoleintr+0xf2>
801008a3:	b8 0a 00 00 00       	mov    $0xa,%eax
801008a8:	89 45 f4             	mov    %eax,-0xc(%ebp)
        input.buf[input.e++ % INPUT_BUF] = c;
801008ab:	a1 9c de 10 80       	mov    0x8010de9c,%eax
801008b0:	89 c1                	mov    %eax,%ecx
801008b2:	83 e1 7f             	and    $0x7f,%ecx
801008b5:	8b 55 f4             	mov    -0xc(%ebp),%edx
801008b8:	88 91 14 de 10 80    	mov    %dl,-0x7fef21ec(%ecx)
801008be:	83 c0 01             	add    $0x1,%eax
801008c1:	a3 9c de 10 80       	mov    %eax,0x8010de9c
        consputc(c);
801008c6:	8b 45 f4             	mov    -0xc(%ebp),%eax
801008c9:	89 04 24             	mov    %eax,(%esp)
801008cc:	e8 88 fe ff ff       	call   80100759 <consputc>
        if(c == '\n' || c == C('D') || input.e == input.r+INPUT_BUF){
801008d1:	83 7d f4 0a          	cmpl   $0xa,-0xc(%ebp)
801008d5:	74 18                	je     801008ef <consoleintr+0x139>
801008d7:	83 7d f4 04          	cmpl   $0x4,-0xc(%ebp)
801008db:	74 12                	je     801008ef <consoleintr+0x139>
801008dd:	a1 9c de 10 80       	mov    0x8010de9c,%eax
801008e2:	8b 15 94 de 10 80    	mov    0x8010de94,%edx
801008e8:	83 ea 80             	sub    $0xffffff80,%edx
801008eb:	39 d0                	cmp    %edx,%eax
801008ed:	75 1e                	jne    8010090d <consoleintr+0x157>
          input.w = input.e;
801008ef:	a1 9c de 10 80       	mov    0x8010de9c,%eax
801008f4:	a3 98 de 10 80       	mov    %eax,0x8010de98
          wakeup(&input.r);
801008f9:	c7 04 24 94 de 10 80 	movl   $0x8010de94,(%esp)
80100900:	e8 19 42 00 00       	call   80104b1e <wakeup>
        }
      }
      break;
80100905:	eb 06                	jmp    8010090d <consoleintr+0x157>
      while(input.e != input.w &&
            input.buf[(input.e-1) % INPUT_BUF] != '\n'){
        input.e--;
        consputc(BACKSPACE);
      }
      break;
80100907:	90                   	nop
80100908:	eb 04                	jmp    8010090e <consoleintr+0x158>
    case C('H'): case '\x7f':  // Backspace
      if(input.e != input.w){
        input.e--;
        consputc(BACKSPACE);
      }
      break;
8010090a:	90                   	nop
8010090b:	eb 01                	jmp    8010090e <consoleintr+0x158>
        if(c == '\n' || c == C('D') || input.e == input.r+INPUT_BUF){
          input.w = input.e;
          wakeup(&input.r);
        }
      }
      break;
8010090d:	90                   	nop
consoleintr(int (*getc)(void))
{
  int c;

  acquire(&input.lock);
  while((c = getc()) >= 0){
8010090e:	8b 45 08             	mov    0x8(%ebp),%eax
80100911:	ff d0                	call   *%eax
80100913:	89 45 f4             	mov    %eax,-0xc(%ebp)
80100916:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
8010091a:	0f 89 ad fe ff ff    	jns    801007cd <consoleintr+0x17>
        }
      }
      break;
    }
  }
  release(&input.lock);
80100920:	c7 04 24 e0 dd 10 80 	movl   $0x8010dde0,(%esp)
80100927:	e8 4d 47 00 00       	call   80105079 <release>
}
8010092c:	c9                   	leave  
8010092d:	c3                   	ret    

8010092e <consoleread>:

int
consoleread(struct inode *ip, char *dst, int n)
{
8010092e:	55                   	push   %ebp
8010092f:	89 e5                	mov    %esp,%ebp
80100931:	83 ec 28             	sub    $0x28,%esp
  uint target;
  int c;

  iunlock(ip);
80100934:	8b 45 08             	mov    0x8(%ebp),%eax
80100937:	89 04 24             	mov    %eax,(%esp)
8010093a:	e8 a3 10 00 00       	call   801019e2 <iunlock>
  target = n;
8010093f:	8b 45 10             	mov    0x10(%ebp),%eax
80100942:	89 45 f4             	mov    %eax,-0xc(%ebp)
  acquire(&input.lock);
80100945:	c7 04 24 e0 dd 10 80 	movl   $0x8010dde0,(%esp)
8010094c:	e8 c6 46 00 00       	call   80105017 <acquire>
  while(n > 0){
80100951:	e9 a8 00 00 00       	jmp    801009fe <consoleread+0xd0>
    while(input.r == input.w){
      if(proc->killed){
80100956:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
8010095c:	8b 40 24             	mov    0x24(%eax),%eax
8010095f:	85 c0                	test   %eax,%eax
80100961:	74 21                	je     80100984 <consoleread+0x56>
        release(&input.lock);
80100963:	c7 04 24 e0 dd 10 80 	movl   $0x8010dde0,(%esp)
8010096a:	e8 0a 47 00 00       	call   80105079 <release>
        ilock(ip);
8010096f:	8b 45 08             	mov    0x8(%ebp),%eax
80100972:	89 04 24             	mov    %eax,(%esp)
80100975:	e8 1a 0f 00 00       	call   80101894 <ilock>
        return -1;
8010097a:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
8010097f:	e9 a9 00 00 00       	jmp    80100a2d <consoleread+0xff>
      }
      sleep(&input.r, &input.lock);
80100984:	c7 44 24 04 e0 dd 10 	movl   $0x8010dde0,0x4(%esp)
8010098b:	80 
8010098c:	c7 04 24 94 de 10 80 	movl   $0x8010de94,(%esp)
80100993:	e8 aa 40 00 00       	call   80104a42 <sleep>
80100998:	eb 01                	jmp    8010099b <consoleread+0x6d>

  iunlock(ip);
  target = n;
  acquire(&input.lock);
  while(n > 0){
    while(input.r == input.w){
8010099a:	90                   	nop
8010099b:	8b 15 94 de 10 80    	mov    0x8010de94,%edx
801009a1:	a1 98 de 10 80       	mov    0x8010de98,%eax
801009a6:	39 c2                	cmp    %eax,%edx
801009a8:	74 ac                	je     80100956 <consoleread+0x28>
        ilock(ip);
        return -1;
      }
      sleep(&input.r, &input.lock);
    }
    c = input.buf[input.r++ % INPUT_BUF];
801009aa:	a1 94 de 10 80       	mov    0x8010de94,%eax
801009af:	89 c2                	mov    %eax,%edx
801009b1:	83 e2 7f             	and    $0x7f,%edx
801009b4:	0f b6 92 14 de 10 80 	movzbl -0x7fef21ec(%edx),%edx
801009bb:	0f be d2             	movsbl %dl,%edx
801009be:	89 55 f0             	mov    %edx,-0x10(%ebp)
801009c1:	83 c0 01             	add    $0x1,%eax
801009c4:	a3 94 de 10 80       	mov    %eax,0x8010de94
    if(c == C('D')){  // EOF
801009c9:	83 7d f0 04          	cmpl   $0x4,-0x10(%ebp)
801009cd:	75 17                	jne    801009e6 <consoleread+0xb8>
      if(n < target){
801009cf:	8b 45 10             	mov    0x10(%ebp),%eax
801009d2:	3b 45 f4             	cmp    -0xc(%ebp),%eax
801009d5:	73 2f                	jae    80100a06 <consoleread+0xd8>
        // Save ^D for next time, to make sure
        // caller gets a 0-byte result.
        input.r--;
801009d7:	a1 94 de 10 80       	mov    0x8010de94,%eax
801009dc:	83 e8 01             	sub    $0x1,%eax
801009df:	a3 94 de 10 80       	mov    %eax,0x8010de94
      }
      break;
801009e4:	eb 20                	jmp    80100a06 <consoleread+0xd8>
    }
    *dst++ = c;
801009e6:	8b 45 f0             	mov    -0x10(%ebp),%eax
801009e9:	89 c2                	mov    %eax,%edx
801009eb:	8b 45 0c             	mov    0xc(%ebp),%eax
801009ee:	88 10                	mov    %dl,(%eax)
801009f0:	83 45 0c 01          	addl   $0x1,0xc(%ebp)
    --n;
801009f4:	83 6d 10 01          	subl   $0x1,0x10(%ebp)
    if(c == '\n')
801009f8:	83 7d f0 0a          	cmpl   $0xa,-0x10(%ebp)
801009fc:	74 0b                	je     80100a09 <consoleread+0xdb>
  int c;

  iunlock(ip);
  target = n;
  acquire(&input.lock);
  while(n > 0){
801009fe:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
80100a02:	7f 96                	jg     8010099a <consoleread+0x6c>
80100a04:	eb 04                	jmp    80100a0a <consoleread+0xdc>
      if(n < target){
        // Save ^D for next time, to make sure
        // caller gets a 0-byte result.
        input.r--;
      }
      break;
80100a06:	90                   	nop
80100a07:	eb 01                	jmp    80100a0a <consoleread+0xdc>
    }
    *dst++ = c;
    --n;
    if(c == '\n')
      break;
80100a09:	90                   	nop
  }
  release(&input.lock);
80100a0a:	c7 04 24 e0 dd 10 80 	movl   $0x8010dde0,(%esp)
80100a11:	e8 63 46 00 00       	call   80105079 <release>
  ilock(ip);
80100a16:	8b 45 08             	mov    0x8(%ebp),%eax
80100a19:	89 04 24             	mov    %eax,(%esp)
80100a1c:	e8 73 0e 00 00       	call   80101894 <ilock>

  return target - n;
80100a21:	8b 45 10             	mov    0x10(%ebp),%eax
80100a24:	8b 55 f4             	mov    -0xc(%ebp),%edx
80100a27:	89 d1                	mov    %edx,%ecx
80100a29:	29 c1                	sub    %eax,%ecx
80100a2b:	89 c8                	mov    %ecx,%eax
}
80100a2d:	c9                   	leave  
80100a2e:	c3                   	ret    

80100a2f <consolewrite>:

int
consolewrite(struct inode *ip, char *buf, int n)
{
80100a2f:	55                   	push   %ebp
80100a30:	89 e5                	mov    %esp,%ebp
80100a32:	83 ec 28             	sub    $0x28,%esp
  int i;

  iunlock(ip);
80100a35:	8b 45 08             	mov    0x8(%ebp),%eax
80100a38:	89 04 24             	mov    %eax,(%esp)
80100a3b:	e8 a2 0f 00 00       	call   801019e2 <iunlock>
  acquire(&cons.lock);
80100a40:	c7 04 24 00 b6 10 80 	movl   $0x8010b600,(%esp)
80100a47:	e8 cb 45 00 00       	call   80105017 <acquire>
  for(i = 0; i < n; i++)
80100a4c:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
80100a53:	eb 1f                	jmp    80100a74 <consolewrite+0x45>
    consputc(buf[i] & 0xff);
80100a55:	8b 55 f4             	mov    -0xc(%ebp),%edx
80100a58:	8b 45 0c             	mov    0xc(%ebp),%eax
80100a5b:	01 d0                	add    %edx,%eax
80100a5d:	0f b6 00             	movzbl (%eax),%eax
80100a60:	0f be c0             	movsbl %al,%eax
80100a63:	25 ff 00 00 00       	and    $0xff,%eax
80100a68:	89 04 24             	mov    %eax,(%esp)
80100a6b:	e8 e9 fc ff ff       	call   80100759 <consputc>
{
  int i;

  iunlock(ip);
  acquire(&cons.lock);
  for(i = 0; i < n; i++)
80100a70:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
80100a74:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100a77:	3b 45 10             	cmp    0x10(%ebp),%eax
80100a7a:	7c d9                	jl     80100a55 <consolewrite+0x26>
    consputc(buf[i] & 0xff);
  release(&cons.lock);
80100a7c:	c7 04 24 00 b6 10 80 	movl   $0x8010b600,(%esp)
80100a83:	e8 f1 45 00 00       	call   80105079 <release>
  ilock(ip);
80100a88:	8b 45 08             	mov    0x8(%ebp),%eax
80100a8b:	89 04 24             	mov    %eax,(%esp)
80100a8e:	e8 01 0e 00 00       	call   80101894 <ilock>

  return n;
80100a93:	8b 45 10             	mov    0x10(%ebp),%eax
}
80100a96:	c9                   	leave  
80100a97:	c3                   	ret    

80100a98 <consoleinit>:

void
consoleinit(void)
{
80100a98:	55                   	push   %ebp
80100a99:	89 e5                	mov    %esp,%ebp
80100a9b:	83 ec 18             	sub    $0x18,%esp
  initlock(&cons.lock, "console");
80100a9e:	c7 44 24 04 4b 87 10 	movl   $0x8010874b,0x4(%esp)
80100aa5:	80 
80100aa6:	c7 04 24 00 b6 10 80 	movl   $0x8010b600,(%esp)
80100aad:	e8 44 45 00 00       	call   80104ff6 <initlock>
  initlock(&input.lock, "input");
80100ab2:	c7 44 24 04 53 87 10 	movl   $0x80108753,0x4(%esp)
80100ab9:	80 
80100aba:	c7 04 24 e0 dd 10 80 	movl   $0x8010dde0,(%esp)
80100ac1:	e8 30 45 00 00       	call   80104ff6 <initlock>

  devsw[CONSOLE].write = consolewrite;
80100ac6:	c7 05 4c e8 10 80 2f 	movl   $0x80100a2f,0x8010e84c
80100acd:	0a 10 80 
  devsw[CONSOLE].read = consoleread;
80100ad0:	c7 05 48 e8 10 80 2e 	movl   $0x8010092e,0x8010e848
80100ad7:	09 10 80 
  cons.locking = 1;
80100ada:	c7 05 34 b6 10 80 01 	movl   $0x1,0x8010b634
80100ae1:	00 00 00 

  picenable(IRQ_KBD);
80100ae4:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
80100aeb:	e8 2d 30 00 00       	call   80103b1d <picenable>
  ioapicenable(IRQ_KBD, 0);
80100af0:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
80100af7:	00 
80100af8:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
80100aff:	e8 be 1e 00 00       	call   801029c2 <ioapicenable>
}
80100b04:	c9                   	leave  
80100b05:	c3                   	ret    
80100b06:	66 90                	xchg   %ax,%ax

80100b08 <exec>:
#include "x86.h"
#include "elf.h"

int
exec(char *path, char **argv)
{
80100b08:	55                   	push   %ebp
80100b09:	89 e5                	mov    %esp,%ebp
80100b0b:	81 ec 38 01 00 00    	sub    $0x138,%esp
  struct elfhdr elf;
  struct inode *ip;
  struct proghdr ph;
  pde_t *pgdir, *oldpgdir;

  if((ip = namei(path)) == 0)
80100b11:	8b 45 08             	mov    0x8(%ebp),%eax
80100b14:	89 04 24             	mov    %eax,(%esp)
80100b17:	e8 39 19 00 00       	call   80102455 <namei>
80100b1c:	89 45 d8             	mov    %eax,-0x28(%ebp)
80100b1f:	83 7d d8 00          	cmpl   $0x0,-0x28(%ebp)
80100b23:	75 0a                	jne    80100b2f <exec+0x27>
    return -1;
80100b25:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80100b2a:	e9 f6 03 00 00       	jmp    80100f25 <exec+0x41d>
  ilock(ip);
80100b2f:	8b 45 d8             	mov    -0x28(%ebp),%eax
80100b32:	89 04 24             	mov    %eax,(%esp)
80100b35:	e8 5a 0d 00 00       	call   80101894 <ilock>
  pgdir = 0;
80100b3a:	c7 45 d4 00 00 00 00 	movl   $0x0,-0x2c(%ebp)

  // Check ELF header
  if(readi(ip, (char*)&elf, 0, sizeof(elf)) < sizeof(elf))
80100b41:	c7 44 24 0c 34 00 00 	movl   $0x34,0xc(%esp)
80100b48:	00 
80100b49:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
80100b50:	00 
80100b51:	8d 85 0c ff ff ff    	lea    -0xf4(%ebp),%eax
80100b57:	89 44 24 04          	mov    %eax,0x4(%esp)
80100b5b:	8b 45 d8             	mov    -0x28(%ebp),%eax
80100b5e:	89 04 24             	mov    %eax,(%esp)
80100b61:	e8 3b 12 00 00       	call   80101da1 <readi>
80100b66:	83 f8 33             	cmp    $0x33,%eax
80100b69:	0f 86 70 03 00 00    	jbe    80100edf <exec+0x3d7>
    goto bad;
  if(elf.magic != ELF_MAGIC)
80100b6f:	8b 85 0c ff ff ff    	mov    -0xf4(%ebp),%eax
80100b75:	3d 7f 45 4c 46       	cmp    $0x464c457f,%eax
80100b7a:	0f 85 62 03 00 00    	jne    80100ee2 <exec+0x3da>
    goto bad;

  if((pgdir = setupkvm(kalloc)) == 0)
80100b80:	c7 04 24 4b 2b 10 80 	movl   $0x80102b4b,(%esp)
80100b87:	e8 13 73 00 00       	call   80107e9f <setupkvm>
80100b8c:	89 45 d4             	mov    %eax,-0x2c(%ebp)
80100b8f:	83 7d d4 00          	cmpl   $0x0,-0x2c(%ebp)
80100b93:	0f 84 4c 03 00 00    	je     80100ee5 <exec+0x3dd>
    goto bad;

  // Load program into memory.
  sz = 0;
80100b99:	c7 45 e0 00 00 00 00 	movl   $0x0,-0x20(%ebp)
  for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){
80100ba0:	c7 45 ec 00 00 00 00 	movl   $0x0,-0x14(%ebp)
80100ba7:	8b 85 28 ff ff ff    	mov    -0xd8(%ebp),%eax
80100bad:	89 45 e8             	mov    %eax,-0x18(%ebp)
80100bb0:	e9 c5 00 00 00       	jmp    80100c7a <exec+0x172>
    if(readi(ip, (char*)&ph, off, sizeof(ph)) != sizeof(ph))
80100bb5:	8b 45 e8             	mov    -0x18(%ebp),%eax
80100bb8:	c7 44 24 0c 20 00 00 	movl   $0x20,0xc(%esp)
80100bbf:	00 
80100bc0:	89 44 24 08          	mov    %eax,0x8(%esp)
80100bc4:	8d 85 ec fe ff ff    	lea    -0x114(%ebp),%eax
80100bca:	89 44 24 04          	mov    %eax,0x4(%esp)
80100bce:	8b 45 d8             	mov    -0x28(%ebp),%eax
80100bd1:	89 04 24             	mov    %eax,(%esp)
80100bd4:	e8 c8 11 00 00       	call   80101da1 <readi>
80100bd9:	83 f8 20             	cmp    $0x20,%eax
80100bdc:	0f 85 06 03 00 00    	jne    80100ee8 <exec+0x3e0>
      goto bad;
    if(ph.type != ELF_PROG_LOAD)
80100be2:	8b 85 ec fe ff ff    	mov    -0x114(%ebp),%eax
80100be8:	83 f8 01             	cmp    $0x1,%eax
80100beb:	75 7f                	jne    80100c6c <exec+0x164>
      continue;
    if(ph.memsz < ph.filesz)
80100bed:	8b 95 00 ff ff ff    	mov    -0x100(%ebp),%edx
80100bf3:	8b 85 fc fe ff ff    	mov    -0x104(%ebp),%eax
80100bf9:	39 c2                	cmp    %eax,%edx
80100bfb:	0f 82 ea 02 00 00    	jb     80100eeb <exec+0x3e3>
      goto bad;
    if((sz = allocuvm(pgdir, sz, ph.vaddr + ph.memsz)) == 0)
80100c01:	8b 95 f4 fe ff ff    	mov    -0x10c(%ebp),%edx
80100c07:	8b 85 00 ff ff ff    	mov    -0x100(%ebp),%eax
80100c0d:	01 d0                	add    %edx,%eax
80100c0f:	89 44 24 08          	mov    %eax,0x8(%esp)
80100c13:	8b 45 e0             	mov    -0x20(%ebp),%eax
80100c16:	89 44 24 04          	mov    %eax,0x4(%esp)
80100c1a:	8b 45 d4             	mov    -0x2c(%ebp),%eax
80100c1d:	89 04 24             	mov    %eax,(%esp)
80100c20:	e8 4c 76 00 00       	call   80108271 <allocuvm>
80100c25:	89 45 e0             	mov    %eax,-0x20(%ebp)
80100c28:	83 7d e0 00          	cmpl   $0x0,-0x20(%ebp)
80100c2c:	0f 84 bc 02 00 00    	je     80100eee <exec+0x3e6>
      goto bad;
    if(loaduvm(pgdir, (char*)ph.vaddr, ip, ph.off, ph.filesz) < 0)
80100c32:	8b 8d fc fe ff ff    	mov    -0x104(%ebp),%ecx
80100c38:	8b 95 f0 fe ff ff    	mov    -0x110(%ebp),%edx
80100c3e:	8b 85 f4 fe ff ff    	mov    -0x10c(%ebp),%eax
80100c44:	89 4c 24 10          	mov    %ecx,0x10(%esp)
80100c48:	89 54 24 0c          	mov    %edx,0xc(%esp)
80100c4c:	8b 55 d8             	mov    -0x28(%ebp),%edx
80100c4f:	89 54 24 08          	mov    %edx,0x8(%esp)
80100c53:	89 44 24 04          	mov    %eax,0x4(%esp)
80100c57:	8b 45 d4             	mov    -0x2c(%ebp),%eax
80100c5a:	89 04 24             	mov    %eax,(%esp)
80100c5d:	e8 20 75 00 00       	call   80108182 <loaduvm>
80100c62:	85 c0                	test   %eax,%eax
80100c64:	0f 88 87 02 00 00    	js     80100ef1 <exec+0x3e9>
80100c6a:	eb 01                	jmp    80100c6d <exec+0x165>
  sz = 0;
  for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){
    if(readi(ip, (char*)&ph, off, sizeof(ph)) != sizeof(ph))
      goto bad;
    if(ph.type != ELF_PROG_LOAD)
      continue;
80100c6c:	90                   	nop
  if((pgdir = setupkvm(kalloc)) == 0)
    goto bad;

  // Load program into memory.
  sz = 0;
  for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){
80100c6d:	83 45 ec 01          	addl   $0x1,-0x14(%ebp)
80100c71:	8b 45 e8             	mov    -0x18(%ebp),%eax
80100c74:	83 c0 20             	add    $0x20,%eax
80100c77:	89 45 e8             	mov    %eax,-0x18(%ebp)
80100c7a:	0f b7 85 38 ff ff ff 	movzwl -0xc8(%ebp),%eax
80100c81:	0f b7 c0             	movzwl %ax,%eax
80100c84:	3b 45 ec             	cmp    -0x14(%ebp),%eax
80100c87:	0f 8f 28 ff ff ff    	jg     80100bb5 <exec+0xad>
    if((sz = allocuvm(pgdir, sz, ph.vaddr + ph.memsz)) == 0)
      goto bad;
    if(loaduvm(pgdir, (char*)ph.vaddr, ip, ph.off, ph.filesz) < 0)
      goto bad;
  }
  iunlockput(ip);
80100c8d:	8b 45 d8             	mov    -0x28(%ebp),%eax
80100c90:	89 04 24             	mov    %eax,(%esp)
80100c93:	e8 80 0e 00 00       	call   80101b18 <iunlockput>
  ip = 0;
80100c98:	c7 45 d8 00 00 00 00 	movl   $0x0,-0x28(%ebp)

  // Allocate two pages at the next page boundary.
  // Make the first inaccessible.  Use the second as the user stack.
  sz = PGROUNDUP(sz);
80100c9f:	8b 45 e0             	mov    -0x20(%ebp),%eax
80100ca2:	05 ff 0f 00 00       	add    $0xfff,%eax
80100ca7:	25 00 f0 ff ff       	and    $0xfffff000,%eax
80100cac:	89 45 e0             	mov    %eax,-0x20(%ebp)
  if((sz = allocuvm(pgdir, sz, sz + 2*PGSIZE)) == 0)
80100caf:	8b 45 e0             	mov    -0x20(%ebp),%eax
80100cb2:	05 00 20 00 00       	add    $0x2000,%eax
80100cb7:	89 44 24 08          	mov    %eax,0x8(%esp)
80100cbb:	8b 45 e0             	mov    -0x20(%ebp),%eax
80100cbe:	89 44 24 04          	mov    %eax,0x4(%esp)
80100cc2:	8b 45 d4             	mov    -0x2c(%ebp),%eax
80100cc5:	89 04 24             	mov    %eax,(%esp)
80100cc8:	e8 a4 75 00 00       	call   80108271 <allocuvm>
80100ccd:	89 45 e0             	mov    %eax,-0x20(%ebp)
80100cd0:	83 7d e0 00          	cmpl   $0x0,-0x20(%ebp)
80100cd4:	0f 84 1a 02 00 00    	je     80100ef4 <exec+0x3ec>
    goto bad;
  clearpteu(pgdir, (char*)(sz - 2*PGSIZE));
80100cda:	8b 45 e0             	mov    -0x20(%ebp),%eax
80100cdd:	2d 00 20 00 00       	sub    $0x2000,%eax
80100ce2:	89 44 24 04          	mov    %eax,0x4(%esp)
80100ce6:	8b 45 d4             	mov    -0x2c(%ebp),%eax
80100ce9:	89 04 24             	mov    %eax,(%esp)
80100cec:	e8 b0 77 00 00       	call   801084a1 <clearpteu>
  sp = sz;
80100cf1:	8b 45 e0             	mov    -0x20(%ebp),%eax
80100cf4:	89 45 dc             	mov    %eax,-0x24(%ebp)

  // Push argument strings, prepare rest of stack in ustack.
  for(argc = 0; argv[argc]; argc++) {
80100cf7:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)
80100cfe:	e9 97 00 00 00       	jmp    80100d9a <exec+0x292>
    if(argc >= MAXARG)
80100d03:	83 7d e4 1f          	cmpl   $0x1f,-0x1c(%ebp)
80100d07:	0f 87 ea 01 00 00    	ja     80100ef7 <exec+0x3ef>
      goto bad;
    sp = (sp - (strlen(argv[argc]) + 1)) & ~3;
80100d0d:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80100d10:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
80100d17:	8b 45 0c             	mov    0xc(%ebp),%eax
80100d1a:	01 d0                	add    %edx,%eax
80100d1c:	8b 00                	mov    (%eax),%eax
80100d1e:	89 04 24             	mov    %eax,(%esp)
80100d21:	e8 ca 47 00 00       	call   801054f0 <strlen>
80100d26:	f7 d0                	not    %eax
80100d28:	89 c2                	mov    %eax,%edx
80100d2a:	8b 45 dc             	mov    -0x24(%ebp),%eax
80100d2d:	01 d0                	add    %edx,%eax
80100d2f:	83 e0 fc             	and    $0xfffffffc,%eax
80100d32:	89 45 dc             	mov    %eax,-0x24(%ebp)
    if(copyout(pgdir, sp, argv[argc], strlen(argv[argc]) + 1) < 0)
80100d35:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80100d38:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
80100d3f:	8b 45 0c             	mov    0xc(%ebp),%eax
80100d42:	01 d0                	add    %edx,%eax
80100d44:	8b 00                	mov    (%eax),%eax
80100d46:	89 04 24             	mov    %eax,(%esp)
80100d49:	e8 a2 47 00 00       	call   801054f0 <strlen>
80100d4e:	83 c0 01             	add    $0x1,%eax
80100d51:	89 c2                	mov    %eax,%edx
80100d53:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80100d56:	8d 0c 85 00 00 00 00 	lea    0x0(,%eax,4),%ecx
80100d5d:	8b 45 0c             	mov    0xc(%ebp),%eax
80100d60:	01 c8                	add    %ecx,%eax
80100d62:	8b 00                	mov    (%eax),%eax
80100d64:	89 54 24 0c          	mov    %edx,0xc(%esp)
80100d68:	89 44 24 08          	mov    %eax,0x8(%esp)
80100d6c:	8b 45 dc             	mov    -0x24(%ebp),%eax
80100d6f:	89 44 24 04          	mov    %eax,0x4(%esp)
80100d73:	8b 45 d4             	mov    -0x2c(%ebp),%eax
80100d76:	89 04 24             	mov    %eax,(%esp)
80100d79:	e8 d7 78 00 00       	call   80108655 <copyout>
80100d7e:	85 c0                	test   %eax,%eax
80100d80:	0f 88 74 01 00 00    	js     80100efa <exec+0x3f2>
      goto bad;
    ustack[3+argc] = sp;
80100d86:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80100d89:	8d 50 03             	lea    0x3(%eax),%edx
80100d8c:	8b 45 dc             	mov    -0x24(%ebp),%eax
80100d8f:	89 84 95 40 ff ff ff 	mov    %eax,-0xc0(%ebp,%edx,4)
    goto bad;
  clearpteu(pgdir, (char*)(sz - 2*PGSIZE));
  sp = sz;

  // Push argument strings, prepare rest of stack in ustack.
  for(argc = 0; argv[argc]; argc++) {
80100d96:	83 45 e4 01          	addl   $0x1,-0x1c(%ebp)
80100d9a:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80100d9d:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
80100da4:	8b 45 0c             	mov    0xc(%ebp),%eax
80100da7:	01 d0                	add    %edx,%eax
80100da9:	8b 00                	mov    (%eax),%eax
80100dab:	85 c0                	test   %eax,%eax
80100dad:	0f 85 50 ff ff ff    	jne    80100d03 <exec+0x1fb>
    sp = (sp - (strlen(argv[argc]) + 1)) & ~3;
    if(copyout(pgdir, sp, argv[argc], strlen(argv[argc]) + 1) < 0)
      goto bad;
    ustack[3+argc] = sp;
  }
  ustack[3+argc] = 0;
80100db3:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80100db6:	83 c0 03             	add    $0x3,%eax
80100db9:	c7 84 85 40 ff ff ff 	movl   $0x0,-0xc0(%ebp,%eax,4)
80100dc0:	00 00 00 00 

  ustack[0] = 0xffffffff;  // fake return PC
80100dc4:	c7 85 40 ff ff ff ff 	movl   $0xffffffff,-0xc0(%ebp)
80100dcb:	ff ff ff 
  ustack[1] = argc;
80100dce:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80100dd1:	89 85 44 ff ff ff    	mov    %eax,-0xbc(%ebp)
  ustack[2] = sp - (argc+1)*4;  // argv pointer
80100dd7:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80100dda:	83 c0 01             	add    $0x1,%eax
80100ddd:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
80100de4:	8b 45 dc             	mov    -0x24(%ebp),%eax
80100de7:	29 d0                	sub    %edx,%eax
80100de9:	89 85 48 ff ff ff    	mov    %eax,-0xb8(%ebp)

  sp -= (3+argc+1) * 4;
80100def:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80100df2:	83 c0 04             	add    $0x4,%eax
80100df5:	c1 e0 02             	shl    $0x2,%eax
80100df8:	29 45 dc             	sub    %eax,-0x24(%ebp)
  if(copyout(pgdir, sp, ustack, (3+argc+1)*4) < 0)
80100dfb:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80100dfe:	83 c0 04             	add    $0x4,%eax
80100e01:	c1 e0 02             	shl    $0x2,%eax
80100e04:	89 44 24 0c          	mov    %eax,0xc(%esp)
80100e08:	8d 85 40 ff ff ff    	lea    -0xc0(%ebp),%eax
80100e0e:	89 44 24 08          	mov    %eax,0x8(%esp)
80100e12:	8b 45 dc             	mov    -0x24(%ebp),%eax
80100e15:	89 44 24 04          	mov    %eax,0x4(%esp)
80100e19:	8b 45 d4             	mov    -0x2c(%ebp),%eax
80100e1c:	89 04 24             	mov    %eax,(%esp)
80100e1f:	e8 31 78 00 00       	call   80108655 <copyout>
80100e24:	85 c0                	test   %eax,%eax
80100e26:	0f 88 d1 00 00 00    	js     80100efd <exec+0x3f5>
    goto bad;

  // Save program name for debugging.
  for(last=s=path; *s; s++)
80100e2c:	8b 45 08             	mov    0x8(%ebp),%eax
80100e2f:	89 45 f4             	mov    %eax,-0xc(%ebp)
80100e32:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100e35:	89 45 f0             	mov    %eax,-0x10(%ebp)
80100e38:	eb 17                	jmp    80100e51 <exec+0x349>
    if(*s == '/')
80100e3a:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100e3d:	0f b6 00             	movzbl (%eax),%eax
80100e40:	3c 2f                	cmp    $0x2f,%al
80100e42:	75 09                	jne    80100e4d <exec+0x345>
      last = s+1;
80100e44:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100e47:	83 c0 01             	add    $0x1,%eax
80100e4a:	89 45 f0             	mov    %eax,-0x10(%ebp)
  sp -= (3+argc+1) * 4;
  if(copyout(pgdir, sp, ustack, (3+argc+1)*4) < 0)
    goto bad;

  // Save program name for debugging.
  for(last=s=path; *s; s++)
80100e4d:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
80100e51:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100e54:	0f b6 00             	movzbl (%eax),%eax
80100e57:	84 c0                	test   %al,%al
80100e59:	75 df                	jne    80100e3a <exec+0x332>
    if(*s == '/')
      last = s+1;
  safestrcpy(proc->name, last, sizeof(proc->name));
80100e5b:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80100e61:	8d 50 6c             	lea    0x6c(%eax),%edx
80100e64:	c7 44 24 08 10 00 00 	movl   $0x10,0x8(%esp)
80100e6b:	00 
80100e6c:	8b 45 f0             	mov    -0x10(%ebp),%eax
80100e6f:	89 44 24 04          	mov    %eax,0x4(%esp)
80100e73:	89 14 24             	mov    %edx,(%esp)
80100e76:	e8 27 46 00 00       	call   801054a2 <safestrcpy>

  // Commit to the user image.
  oldpgdir = proc->pgdir;
80100e7b:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80100e81:	8b 40 04             	mov    0x4(%eax),%eax
80100e84:	89 45 d0             	mov    %eax,-0x30(%ebp)
  proc->pgdir = pgdir;
80100e87:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80100e8d:	8b 55 d4             	mov    -0x2c(%ebp),%edx
80100e90:	89 50 04             	mov    %edx,0x4(%eax)
  proc->sz = sz;
80100e93:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80100e99:	8b 55 e0             	mov    -0x20(%ebp),%edx
80100e9c:	89 10                	mov    %edx,(%eax)
  proc->tf->eip = elf.entry;  // main
80100e9e:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80100ea4:	8b 40 18             	mov    0x18(%eax),%eax
80100ea7:	8b 95 24 ff ff ff    	mov    -0xdc(%ebp),%edx
80100ead:	89 50 38             	mov    %edx,0x38(%eax)
  proc->tf->esp = sp;
80100eb0:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80100eb6:	8b 40 18             	mov    0x18(%eax),%eax
80100eb9:	8b 55 dc             	mov    -0x24(%ebp),%edx
80100ebc:	89 50 44             	mov    %edx,0x44(%eax)
  switchuvm(proc);
80100ebf:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80100ec5:	89 04 24             	mov    %eax,(%esp)
80100ec8:	e8 c3 70 00 00       	call   80107f90 <switchuvm>
  freevm(oldpgdir);
80100ecd:	8b 45 d0             	mov    -0x30(%ebp),%eax
80100ed0:	89 04 24             	mov    %eax,(%esp)
80100ed3:	e8 2f 75 00 00       	call   80108407 <freevm>
  return 0;
80100ed8:	b8 00 00 00 00       	mov    $0x0,%eax
80100edd:	eb 46                	jmp    80100f25 <exec+0x41d>
  ilock(ip);
  pgdir = 0;

  // Check ELF header
  if(readi(ip, (char*)&elf, 0, sizeof(elf)) < sizeof(elf))
    goto bad;
80100edf:	90                   	nop
80100ee0:	eb 1c                	jmp    80100efe <exec+0x3f6>
  if(elf.magic != ELF_MAGIC)
    goto bad;
80100ee2:	90                   	nop
80100ee3:	eb 19                	jmp    80100efe <exec+0x3f6>

  if((pgdir = setupkvm(kalloc)) == 0)
    goto bad;
80100ee5:	90                   	nop
80100ee6:	eb 16                	jmp    80100efe <exec+0x3f6>

  // Load program into memory.
  sz = 0;
  for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){
    if(readi(ip, (char*)&ph, off, sizeof(ph)) != sizeof(ph))
      goto bad;
80100ee8:	90                   	nop
80100ee9:	eb 13                	jmp    80100efe <exec+0x3f6>
    if(ph.type != ELF_PROG_LOAD)
      continue;
    if(ph.memsz < ph.filesz)
      goto bad;
80100eeb:	90                   	nop
80100eec:	eb 10                	jmp    80100efe <exec+0x3f6>
    if((sz = allocuvm(pgdir, sz, ph.vaddr + ph.memsz)) == 0)
      goto bad;
80100eee:	90                   	nop
80100eef:	eb 0d                	jmp    80100efe <exec+0x3f6>
    if(loaduvm(pgdir, (char*)ph.vaddr, ip, ph.off, ph.filesz) < 0)
      goto bad;
80100ef1:	90                   	nop
80100ef2:	eb 0a                	jmp    80100efe <exec+0x3f6>

  // Allocate two pages at the next page boundary.
  // Make the first inaccessible.  Use the second as the user stack.
  sz = PGROUNDUP(sz);
  if((sz = allocuvm(pgdir, sz, sz + 2*PGSIZE)) == 0)
    goto bad;
80100ef4:	90                   	nop
80100ef5:	eb 07                	jmp    80100efe <exec+0x3f6>
  sp = sz;

  // Push argument strings, prepare rest of stack in ustack.
  for(argc = 0; argv[argc]; argc++) {
    if(argc >= MAXARG)
      goto bad;
80100ef7:	90                   	nop
80100ef8:	eb 04                	jmp    80100efe <exec+0x3f6>
    sp = (sp - (strlen(argv[argc]) + 1)) & ~3;
    if(copyout(pgdir, sp, argv[argc], strlen(argv[argc]) + 1) < 0)
      goto bad;
80100efa:	90                   	nop
80100efb:	eb 01                	jmp    80100efe <exec+0x3f6>
  ustack[1] = argc;
  ustack[2] = sp - (argc+1)*4;  // argv pointer

  sp -= (3+argc+1) * 4;
  if(copyout(pgdir, sp, ustack, (3+argc+1)*4) < 0)
    goto bad;
80100efd:	90                   	nop
  switchuvm(proc);
  freevm(oldpgdir);
  return 0;

 bad:
  if(pgdir)
80100efe:	83 7d d4 00          	cmpl   $0x0,-0x2c(%ebp)
80100f02:	74 0b                	je     80100f0f <exec+0x407>
    freevm(pgdir);
80100f04:	8b 45 d4             	mov    -0x2c(%ebp),%eax
80100f07:	89 04 24             	mov    %eax,(%esp)
80100f0a:	e8 f8 74 00 00       	call   80108407 <freevm>
  if(ip)
80100f0f:	83 7d d8 00          	cmpl   $0x0,-0x28(%ebp)
80100f13:	74 0b                	je     80100f20 <exec+0x418>
    iunlockput(ip);
80100f15:	8b 45 d8             	mov    -0x28(%ebp),%eax
80100f18:	89 04 24             	mov    %eax,(%esp)
80100f1b:	e8 f8 0b 00 00       	call   80101b18 <iunlockput>
  return -1;
80100f20:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
}
80100f25:	c9                   	leave  
80100f26:	c3                   	ret    
80100f27:	90                   	nop

80100f28 <fileinit>:
  struct file file[NFILE];
} ftable;

void
fileinit(void)
{
80100f28:	55                   	push   %ebp
80100f29:	89 e5                	mov    %esp,%ebp
80100f2b:	83 ec 18             	sub    $0x18,%esp
  initlock(&ftable.lock, "ftable");
80100f2e:	c7 44 24 04 59 87 10 	movl   $0x80108759,0x4(%esp)
80100f35:	80 
80100f36:	c7 04 24 a0 de 10 80 	movl   $0x8010dea0,(%esp)
80100f3d:	e8 b4 40 00 00       	call   80104ff6 <initlock>
}
80100f42:	c9                   	leave  
80100f43:	c3                   	ret    

80100f44 <filealloc>:

// Allocate a file structure.
struct file*
filealloc(void)
{
80100f44:	55                   	push   %ebp
80100f45:	89 e5                	mov    %esp,%ebp
80100f47:	83 ec 28             	sub    $0x28,%esp
  struct file *f;

  acquire(&ftable.lock);
80100f4a:	c7 04 24 a0 de 10 80 	movl   $0x8010dea0,(%esp)
80100f51:	e8 c1 40 00 00       	call   80105017 <acquire>
  for(f = ftable.file; f < ftable.file + NFILE; f++){
80100f56:	c7 45 f4 d4 de 10 80 	movl   $0x8010ded4,-0xc(%ebp)
80100f5d:	eb 29                	jmp    80100f88 <filealloc+0x44>
    if(f->ref == 0){
80100f5f:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100f62:	8b 40 04             	mov    0x4(%eax),%eax
80100f65:	85 c0                	test   %eax,%eax
80100f67:	75 1b                	jne    80100f84 <filealloc+0x40>
      f->ref = 1;
80100f69:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100f6c:	c7 40 04 01 00 00 00 	movl   $0x1,0x4(%eax)
      release(&ftable.lock);
80100f73:	c7 04 24 a0 de 10 80 	movl   $0x8010dea0,(%esp)
80100f7a:	e8 fa 40 00 00       	call   80105079 <release>
      return f;
80100f7f:	8b 45 f4             	mov    -0xc(%ebp),%eax
80100f82:	eb 1e                	jmp    80100fa2 <filealloc+0x5e>
filealloc(void)
{
  struct file *f;

  acquire(&ftable.lock);
  for(f = ftable.file; f < ftable.file + NFILE; f++){
80100f84:	83 45 f4 18          	addl   $0x18,-0xc(%ebp)
80100f88:	81 7d f4 34 e8 10 80 	cmpl   $0x8010e834,-0xc(%ebp)
80100f8f:	72 ce                	jb     80100f5f <filealloc+0x1b>
      f->ref = 1;
      release(&ftable.lock);
      return f;
    }
  }
  release(&ftable.lock);
80100f91:	c7 04 24 a0 de 10 80 	movl   $0x8010dea0,(%esp)
80100f98:	e8 dc 40 00 00       	call   80105079 <release>
  return 0;
80100f9d:	b8 00 00 00 00       	mov    $0x0,%eax
}
80100fa2:	c9                   	leave  
80100fa3:	c3                   	ret    

80100fa4 <filedup>:

// Increment ref count for file f.
struct file*
filedup(struct file *f)
{
80100fa4:	55                   	push   %ebp
80100fa5:	89 e5                	mov    %esp,%ebp
80100fa7:	83 ec 18             	sub    $0x18,%esp
  acquire(&ftable.lock);
80100faa:	c7 04 24 a0 de 10 80 	movl   $0x8010dea0,(%esp)
80100fb1:	e8 61 40 00 00       	call   80105017 <acquire>
  if(f->ref < 1)
80100fb6:	8b 45 08             	mov    0x8(%ebp),%eax
80100fb9:	8b 40 04             	mov    0x4(%eax),%eax
80100fbc:	85 c0                	test   %eax,%eax
80100fbe:	7f 0c                	jg     80100fcc <filedup+0x28>
    panic("filedup");
80100fc0:	c7 04 24 60 87 10 80 	movl   $0x80108760,(%esp)
80100fc7:	e8 7a f5 ff ff       	call   80100546 <panic>
  f->ref++;
80100fcc:	8b 45 08             	mov    0x8(%ebp),%eax
80100fcf:	8b 40 04             	mov    0x4(%eax),%eax
80100fd2:	8d 50 01             	lea    0x1(%eax),%edx
80100fd5:	8b 45 08             	mov    0x8(%ebp),%eax
80100fd8:	89 50 04             	mov    %edx,0x4(%eax)
  release(&ftable.lock);
80100fdb:	c7 04 24 a0 de 10 80 	movl   $0x8010dea0,(%esp)
80100fe2:	e8 92 40 00 00       	call   80105079 <release>
  return f;
80100fe7:	8b 45 08             	mov    0x8(%ebp),%eax
}
80100fea:	c9                   	leave  
80100feb:	c3                   	ret    

80100fec <fileclose>:

// Close file f.  (Decrement ref count, close when reaches 0.)
void
fileclose(struct file *f)
{
80100fec:	55                   	push   %ebp
80100fed:	89 e5                	mov    %esp,%ebp
80100fef:	83 ec 38             	sub    $0x38,%esp
  struct file ff;

  acquire(&ftable.lock);
80100ff2:	c7 04 24 a0 de 10 80 	movl   $0x8010dea0,(%esp)
80100ff9:	e8 19 40 00 00       	call   80105017 <acquire>
  if(f->ref < 1)
80100ffe:	8b 45 08             	mov    0x8(%ebp),%eax
80101001:	8b 40 04             	mov    0x4(%eax),%eax
80101004:	85 c0                	test   %eax,%eax
80101006:	7f 0c                	jg     80101014 <fileclose+0x28>
    panic("fileclose");
80101008:	c7 04 24 68 87 10 80 	movl   $0x80108768,(%esp)
8010100f:	e8 32 f5 ff ff       	call   80100546 <panic>
  if(--f->ref > 0){
80101014:	8b 45 08             	mov    0x8(%ebp),%eax
80101017:	8b 40 04             	mov    0x4(%eax),%eax
8010101a:	8d 50 ff             	lea    -0x1(%eax),%edx
8010101d:	8b 45 08             	mov    0x8(%ebp),%eax
80101020:	89 50 04             	mov    %edx,0x4(%eax)
80101023:	8b 45 08             	mov    0x8(%ebp),%eax
80101026:	8b 40 04             	mov    0x4(%eax),%eax
80101029:	85 c0                	test   %eax,%eax
8010102b:	7e 11                	jle    8010103e <fileclose+0x52>
    release(&ftable.lock);
8010102d:	c7 04 24 a0 de 10 80 	movl   $0x8010dea0,(%esp)
80101034:	e8 40 40 00 00       	call   80105079 <release>
80101039:	e9 82 00 00 00       	jmp    801010c0 <fileclose+0xd4>
    return;
  }
  ff = *f;
8010103e:	8b 45 08             	mov    0x8(%ebp),%eax
80101041:	8b 10                	mov    (%eax),%edx
80101043:	89 55 e0             	mov    %edx,-0x20(%ebp)
80101046:	8b 50 04             	mov    0x4(%eax),%edx
80101049:	89 55 e4             	mov    %edx,-0x1c(%ebp)
8010104c:	8b 50 08             	mov    0x8(%eax),%edx
8010104f:	89 55 e8             	mov    %edx,-0x18(%ebp)
80101052:	8b 50 0c             	mov    0xc(%eax),%edx
80101055:	89 55 ec             	mov    %edx,-0x14(%ebp)
80101058:	8b 50 10             	mov    0x10(%eax),%edx
8010105b:	89 55 f0             	mov    %edx,-0x10(%ebp)
8010105e:	8b 40 14             	mov    0x14(%eax),%eax
80101061:	89 45 f4             	mov    %eax,-0xc(%ebp)
  f->ref = 0;
80101064:	8b 45 08             	mov    0x8(%ebp),%eax
80101067:	c7 40 04 00 00 00 00 	movl   $0x0,0x4(%eax)
  f->type = FD_NONE;
8010106e:	8b 45 08             	mov    0x8(%ebp),%eax
80101071:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
  release(&ftable.lock);
80101077:	c7 04 24 a0 de 10 80 	movl   $0x8010dea0,(%esp)
8010107e:	e8 f6 3f 00 00       	call   80105079 <release>
  
  if(ff.type == FD_PIPE)
80101083:	8b 45 e0             	mov    -0x20(%ebp),%eax
80101086:	83 f8 01             	cmp    $0x1,%eax
80101089:	75 18                	jne    801010a3 <fileclose+0xb7>
    pipeclose(ff.pipe, ff.writable);
8010108b:	0f b6 45 e9          	movzbl -0x17(%ebp),%eax
8010108f:	0f be d0             	movsbl %al,%edx
80101092:	8b 45 ec             	mov    -0x14(%ebp),%eax
80101095:	89 54 24 04          	mov    %edx,0x4(%esp)
80101099:	89 04 24             	mov    %eax,(%esp)
8010109c:	e8 36 2d 00 00       	call   80103dd7 <pipeclose>
801010a1:	eb 1d                	jmp    801010c0 <fileclose+0xd4>
  else if(ff.type == FD_INODE){
801010a3:	8b 45 e0             	mov    -0x20(%ebp),%eax
801010a6:	83 f8 02             	cmp    $0x2,%eax
801010a9:	75 15                	jne    801010c0 <fileclose+0xd4>
    begin_trans();
801010ab:	e8 c0 21 00 00       	call   80103270 <begin_trans>
    iput(ff.ip);
801010b0:	8b 45 f0             	mov    -0x10(%ebp),%eax
801010b3:	89 04 24             	mov    %eax,(%esp)
801010b6:	e8 8c 09 00 00       	call   80101a47 <iput>
    commit_trans();
801010bb:	e8 f9 21 00 00       	call   801032b9 <commit_trans>
  }
}
801010c0:	c9                   	leave  
801010c1:	c3                   	ret    

801010c2 <filestat>:

// Get metadata about file f.
int
filestat(struct file *f, struct stat *st)
{
801010c2:	55                   	push   %ebp
801010c3:	89 e5                	mov    %esp,%ebp
801010c5:	83 ec 18             	sub    $0x18,%esp
  if(f->type == FD_INODE){
801010c8:	8b 45 08             	mov    0x8(%ebp),%eax
801010cb:	8b 00                	mov    (%eax),%eax
801010cd:	83 f8 02             	cmp    $0x2,%eax
801010d0:	75 38                	jne    8010110a <filestat+0x48>
    ilock(f->ip);
801010d2:	8b 45 08             	mov    0x8(%ebp),%eax
801010d5:	8b 40 10             	mov    0x10(%eax),%eax
801010d8:	89 04 24             	mov    %eax,(%esp)
801010db:	e8 b4 07 00 00       	call   80101894 <ilock>
    stati(f->ip, st);
801010e0:	8b 45 08             	mov    0x8(%ebp),%eax
801010e3:	8b 40 10             	mov    0x10(%eax),%eax
801010e6:	8b 55 0c             	mov    0xc(%ebp),%edx
801010e9:	89 54 24 04          	mov    %edx,0x4(%esp)
801010ed:	89 04 24             	mov    %eax,(%esp)
801010f0:	e8 67 0c 00 00       	call   80101d5c <stati>
    iunlock(f->ip);
801010f5:	8b 45 08             	mov    0x8(%ebp),%eax
801010f8:	8b 40 10             	mov    0x10(%eax),%eax
801010fb:	89 04 24             	mov    %eax,(%esp)
801010fe:	e8 df 08 00 00       	call   801019e2 <iunlock>
    return 0;
80101103:	b8 00 00 00 00       	mov    $0x0,%eax
80101108:	eb 05                	jmp    8010110f <filestat+0x4d>
  }
  return -1;
8010110a:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
}
8010110f:	c9                   	leave  
80101110:	c3                   	ret    

80101111 <fileread>:

// Read from file f.
int
fileread(struct file *f, char *addr, int n)
{
80101111:	55                   	push   %ebp
80101112:	89 e5                	mov    %esp,%ebp
80101114:	83 ec 28             	sub    $0x28,%esp
  int r;

  if(f->readable == 0)
80101117:	8b 45 08             	mov    0x8(%ebp),%eax
8010111a:	0f b6 40 08          	movzbl 0x8(%eax),%eax
8010111e:	84 c0                	test   %al,%al
80101120:	75 0a                	jne    8010112c <fileread+0x1b>
    return -1;
80101122:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80101127:	e9 9f 00 00 00       	jmp    801011cb <fileread+0xba>
  if(f->type == FD_PIPE)
8010112c:	8b 45 08             	mov    0x8(%ebp),%eax
8010112f:	8b 00                	mov    (%eax),%eax
80101131:	83 f8 01             	cmp    $0x1,%eax
80101134:	75 1e                	jne    80101154 <fileread+0x43>
    return piperead(f->pipe, addr, n);
80101136:	8b 45 08             	mov    0x8(%ebp),%eax
80101139:	8b 40 0c             	mov    0xc(%eax),%eax
8010113c:	8b 55 10             	mov    0x10(%ebp),%edx
8010113f:	89 54 24 08          	mov    %edx,0x8(%esp)
80101143:	8b 55 0c             	mov    0xc(%ebp),%edx
80101146:	89 54 24 04          	mov    %edx,0x4(%esp)
8010114a:	89 04 24             	mov    %eax,(%esp)
8010114d:	e8 09 2e 00 00       	call   80103f5b <piperead>
80101152:	eb 77                	jmp    801011cb <fileread+0xba>
  if(f->type == FD_INODE){
80101154:	8b 45 08             	mov    0x8(%ebp),%eax
80101157:	8b 00                	mov    (%eax),%eax
80101159:	83 f8 02             	cmp    $0x2,%eax
8010115c:	75 61                	jne    801011bf <fileread+0xae>
    ilock(f->ip);
8010115e:	8b 45 08             	mov    0x8(%ebp),%eax
80101161:	8b 40 10             	mov    0x10(%eax),%eax
80101164:	89 04 24             	mov    %eax,(%esp)
80101167:	e8 28 07 00 00       	call   80101894 <ilock>
    if((r = readi(f->ip, addr, f->off, n)) > 0)
8010116c:	8b 4d 10             	mov    0x10(%ebp),%ecx
8010116f:	8b 45 08             	mov    0x8(%ebp),%eax
80101172:	8b 50 14             	mov    0x14(%eax),%edx
80101175:	8b 45 08             	mov    0x8(%ebp),%eax
80101178:	8b 40 10             	mov    0x10(%eax),%eax
8010117b:	89 4c 24 0c          	mov    %ecx,0xc(%esp)
8010117f:	89 54 24 08          	mov    %edx,0x8(%esp)
80101183:	8b 55 0c             	mov    0xc(%ebp),%edx
80101186:	89 54 24 04          	mov    %edx,0x4(%esp)
8010118a:	89 04 24             	mov    %eax,(%esp)
8010118d:	e8 0f 0c 00 00       	call   80101da1 <readi>
80101192:	89 45 f4             	mov    %eax,-0xc(%ebp)
80101195:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80101199:	7e 11                	jle    801011ac <fileread+0x9b>
      f->off += r;
8010119b:	8b 45 08             	mov    0x8(%ebp),%eax
8010119e:	8b 50 14             	mov    0x14(%eax),%edx
801011a1:	8b 45 f4             	mov    -0xc(%ebp),%eax
801011a4:	01 c2                	add    %eax,%edx
801011a6:	8b 45 08             	mov    0x8(%ebp),%eax
801011a9:	89 50 14             	mov    %edx,0x14(%eax)
    iunlock(f->ip);
801011ac:	8b 45 08             	mov    0x8(%ebp),%eax
801011af:	8b 40 10             	mov    0x10(%eax),%eax
801011b2:	89 04 24             	mov    %eax,(%esp)
801011b5:	e8 28 08 00 00       	call   801019e2 <iunlock>
    return r;
801011ba:	8b 45 f4             	mov    -0xc(%ebp),%eax
801011bd:	eb 0c                	jmp    801011cb <fileread+0xba>
  }
  panic("fileread");
801011bf:	c7 04 24 72 87 10 80 	movl   $0x80108772,(%esp)
801011c6:	e8 7b f3 ff ff       	call   80100546 <panic>
}
801011cb:	c9                   	leave  
801011cc:	c3                   	ret    

801011cd <filewrite>:

//PAGEBREAK!
// Write to file f.
int
filewrite(struct file *f, char *addr, int n)
{
801011cd:	55                   	push   %ebp
801011ce:	89 e5                	mov    %esp,%ebp
801011d0:	53                   	push   %ebx
801011d1:	83 ec 24             	sub    $0x24,%esp
  int r;

  if(f->writable == 0)
801011d4:	8b 45 08             	mov    0x8(%ebp),%eax
801011d7:	0f b6 40 09          	movzbl 0x9(%eax),%eax
801011db:	84 c0                	test   %al,%al
801011dd:	75 0a                	jne    801011e9 <filewrite+0x1c>
    return -1;
801011df:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
801011e4:	e9 23 01 00 00       	jmp    8010130c <filewrite+0x13f>
  if(f->type == FD_PIPE)
801011e9:	8b 45 08             	mov    0x8(%ebp),%eax
801011ec:	8b 00                	mov    (%eax),%eax
801011ee:	83 f8 01             	cmp    $0x1,%eax
801011f1:	75 21                	jne    80101214 <filewrite+0x47>
    return pipewrite(f->pipe, addr, n);
801011f3:	8b 45 08             	mov    0x8(%ebp),%eax
801011f6:	8b 40 0c             	mov    0xc(%eax),%eax
801011f9:	8b 55 10             	mov    0x10(%ebp),%edx
801011fc:	89 54 24 08          	mov    %edx,0x8(%esp)
80101200:	8b 55 0c             	mov    0xc(%ebp),%edx
80101203:	89 54 24 04          	mov    %edx,0x4(%esp)
80101207:	89 04 24             	mov    %eax,(%esp)
8010120a:	e8 5a 2c 00 00       	call   80103e69 <pipewrite>
8010120f:	e9 f8 00 00 00       	jmp    8010130c <filewrite+0x13f>
  if(f->type == FD_INODE){
80101214:	8b 45 08             	mov    0x8(%ebp),%eax
80101217:	8b 00                	mov    (%eax),%eax
80101219:	83 f8 02             	cmp    $0x2,%eax
8010121c:	0f 85 de 00 00 00    	jne    80101300 <filewrite+0x133>
    // the maximum log transaction size, including
    // i-node, indirect block, allocation blocks,
    // and 2 blocks of slop for non-aligned writes.
    // this really belongs lower down, since writei()
    // might be writing a device like the console.
    int max = ((LOGSIZE-1-1-2) / 2) * 512;
80101222:	c7 45 ec 00 06 00 00 	movl   $0x600,-0x14(%ebp)
    int i = 0;
80101229:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
    while(i < n){
80101230:	e9 a8 00 00 00       	jmp    801012dd <filewrite+0x110>
      int n1 = n - i;
80101235:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101238:	8b 55 10             	mov    0x10(%ebp),%edx
8010123b:	89 d1                	mov    %edx,%ecx
8010123d:	29 c1                	sub    %eax,%ecx
8010123f:	89 c8                	mov    %ecx,%eax
80101241:	89 45 f0             	mov    %eax,-0x10(%ebp)
      if(n1 > max)
80101244:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101247:	3b 45 ec             	cmp    -0x14(%ebp),%eax
8010124a:	7e 06                	jle    80101252 <filewrite+0x85>
        n1 = max;
8010124c:	8b 45 ec             	mov    -0x14(%ebp),%eax
8010124f:	89 45 f0             	mov    %eax,-0x10(%ebp)

      begin_trans();
80101252:	e8 19 20 00 00       	call   80103270 <begin_trans>
      ilock(f->ip);
80101257:	8b 45 08             	mov    0x8(%ebp),%eax
8010125a:	8b 40 10             	mov    0x10(%eax),%eax
8010125d:	89 04 24             	mov    %eax,(%esp)
80101260:	e8 2f 06 00 00       	call   80101894 <ilock>
      if ((r = writei(f->ip, addr + i, f->off, n1)) > 0)
80101265:	8b 4d f0             	mov    -0x10(%ebp),%ecx
80101268:	8b 45 08             	mov    0x8(%ebp),%eax
8010126b:	8b 50 14             	mov    0x14(%eax),%edx
8010126e:	8b 5d f4             	mov    -0xc(%ebp),%ebx
80101271:	8b 45 0c             	mov    0xc(%ebp),%eax
80101274:	01 c3                	add    %eax,%ebx
80101276:	8b 45 08             	mov    0x8(%ebp),%eax
80101279:	8b 40 10             	mov    0x10(%eax),%eax
8010127c:	89 4c 24 0c          	mov    %ecx,0xc(%esp)
80101280:	89 54 24 08          	mov    %edx,0x8(%esp)
80101284:	89 5c 24 04          	mov    %ebx,0x4(%esp)
80101288:	89 04 24             	mov    %eax,(%esp)
8010128b:	e8 7f 0c 00 00       	call   80101f0f <writei>
80101290:	89 45 e8             	mov    %eax,-0x18(%ebp)
80101293:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
80101297:	7e 11                	jle    801012aa <filewrite+0xdd>
        f->off += r;
80101299:	8b 45 08             	mov    0x8(%ebp),%eax
8010129c:	8b 50 14             	mov    0x14(%eax),%edx
8010129f:	8b 45 e8             	mov    -0x18(%ebp),%eax
801012a2:	01 c2                	add    %eax,%edx
801012a4:	8b 45 08             	mov    0x8(%ebp),%eax
801012a7:	89 50 14             	mov    %edx,0x14(%eax)
      iunlock(f->ip);
801012aa:	8b 45 08             	mov    0x8(%ebp),%eax
801012ad:	8b 40 10             	mov    0x10(%eax),%eax
801012b0:	89 04 24             	mov    %eax,(%esp)
801012b3:	e8 2a 07 00 00       	call   801019e2 <iunlock>
      commit_trans();
801012b8:	e8 fc 1f 00 00       	call   801032b9 <commit_trans>

      if(r < 0)
801012bd:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
801012c1:	78 28                	js     801012eb <filewrite+0x11e>
        break;
      if(r != n1)
801012c3:	8b 45 e8             	mov    -0x18(%ebp),%eax
801012c6:	3b 45 f0             	cmp    -0x10(%ebp),%eax
801012c9:	74 0c                	je     801012d7 <filewrite+0x10a>
        panic("short filewrite");
801012cb:	c7 04 24 7b 87 10 80 	movl   $0x8010877b,(%esp)
801012d2:	e8 6f f2 ff ff       	call   80100546 <panic>
      i += r;
801012d7:	8b 45 e8             	mov    -0x18(%ebp),%eax
801012da:	01 45 f4             	add    %eax,-0xc(%ebp)
    // and 2 blocks of slop for non-aligned writes.
    // this really belongs lower down, since writei()
    // might be writing a device like the console.
    int max = ((LOGSIZE-1-1-2) / 2) * 512;
    int i = 0;
    while(i < n){
801012dd:	8b 45 f4             	mov    -0xc(%ebp),%eax
801012e0:	3b 45 10             	cmp    0x10(%ebp),%eax
801012e3:	0f 8c 4c ff ff ff    	jl     80101235 <filewrite+0x68>
801012e9:	eb 01                	jmp    801012ec <filewrite+0x11f>
        f->off += r;
      iunlock(f->ip);
      commit_trans();

      if(r < 0)
        break;
801012eb:	90                   	nop
      if(r != n1)
        panic("short filewrite");
      i += r;
    }
    return i == n ? n : -1;
801012ec:	8b 45 f4             	mov    -0xc(%ebp),%eax
801012ef:	3b 45 10             	cmp    0x10(%ebp),%eax
801012f2:	75 05                	jne    801012f9 <filewrite+0x12c>
801012f4:	8b 45 10             	mov    0x10(%ebp),%eax
801012f7:	eb 05                	jmp    801012fe <filewrite+0x131>
801012f9:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
801012fe:	eb 0c                	jmp    8010130c <filewrite+0x13f>
  }
  panic("filewrite");
80101300:	c7 04 24 8b 87 10 80 	movl   $0x8010878b,(%esp)
80101307:	e8 3a f2 ff ff       	call   80100546 <panic>
}
8010130c:	83 c4 24             	add    $0x24,%esp
8010130f:	5b                   	pop    %ebx
80101310:	5d                   	pop    %ebp
80101311:	c3                   	ret    
80101312:	66 90                	xchg   %ax,%ax

80101314 <readsb>:
static void itrunc(struct inode*);

// Read the super block.
void
readsb(int dev, struct superblock *sb)
{
80101314:	55                   	push   %ebp
80101315:	89 e5                	mov    %esp,%ebp
80101317:	83 ec 28             	sub    $0x28,%esp
  struct buf *bp;
  
  bp = bread(dev, 1);
8010131a:	8b 45 08             	mov    0x8(%ebp),%eax
8010131d:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
80101324:	00 
80101325:	89 04 24             	mov    %eax,(%esp)
80101328:	e8 79 ee ff ff       	call   801001a6 <bread>
8010132d:	89 45 f4             	mov    %eax,-0xc(%ebp)
  memmove(sb, bp->data, sizeof(*sb));
80101330:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101333:	83 c0 18             	add    $0x18,%eax
80101336:	c7 44 24 08 10 00 00 	movl   $0x10,0x8(%esp)
8010133d:	00 
8010133e:	89 44 24 04          	mov    %eax,0x4(%esp)
80101342:	8b 45 0c             	mov    0xc(%ebp),%eax
80101345:	89 04 24             	mov    %eax,(%esp)
80101348:	e8 f8 3f 00 00       	call   80105345 <memmove>
  brelse(bp);
8010134d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101350:	89 04 24             	mov    %eax,(%esp)
80101353:	e8 bf ee ff ff       	call   80100217 <brelse>
}
80101358:	c9                   	leave  
80101359:	c3                   	ret    

8010135a <bzero>:

// Zero a block.
static void
bzero(int dev, int bno)
{
8010135a:	55                   	push   %ebp
8010135b:	89 e5                	mov    %esp,%ebp
8010135d:	83 ec 28             	sub    $0x28,%esp
  struct buf *bp;
  
  bp = bread(dev, bno);
80101360:	8b 55 0c             	mov    0xc(%ebp),%edx
80101363:	8b 45 08             	mov    0x8(%ebp),%eax
80101366:	89 54 24 04          	mov    %edx,0x4(%esp)
8010136a:	89 04 24             	mov    %eax,(%esp)
8010136d:	e8 34 ee ff ff       	call   801001a6 <bread>
80101372:	89 45 f4             	mov    %eax,-0xc(%ebp)
  memset(bp->data, 0, BSIZE);
80101375:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101378:	83 c0 18             	add    $0x18,%eax
8010137b:	c7 44 24 08 00 02 00 	movl   $0x200,0x8(%esp)
80101382:	00 
80101383:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
8010138a:	00 
8010138b:	89 04 24             	mov    %eax,(%esp)
8010138e:	e8 df 3e 00 00       	call   80105272 <memset>
  log_write(bp);
80101393:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101396:	89 04 24             	mov    %eax,(%esp)
80101399:	e8 73 1f 00 00       	call   80103311 <log_write>
  brelse(bp);
8010139e:	8b 45 f4             	mov    -0xc(%ebp),%eax
801013a1:	89 04 24             	mov    %eax,(%esp)
801013a4:	e8 6e ee ff ff       	call   80100217 <brelse>
}
801013a9:	c9                   	leave  
801013aa:	c3                   	ret    

801013ab <balloc>:
// Blocks. 

// Allocate a zeroed disk block.
static uint
balloc(uint dev)
{
801013ab:	55                   	push   %ebp
801013ac:	89 e5                	mov    %esp,%ebp
801013ae:	53                   	push   %ebx
801013af:	83 ec 34             	sub    $0x34,%esp
  int b, bi, m;
  struct buf *bp;
  struct superblock sb;

  bp = 0;
801013b2:	c7 45 ec 00 00 00 00 	movl   $0x0,-0x14(%ebp)
  readsb(dev, &sb);
801013b9:	8b 45 08             	mov    0x8(%ebp),%eax
801013bc:	8d 55 d8             	lea    -0x28(%ebp),%edx
801013bf:	89 54 24 04          	mov    %edx,0x4(%esp)
801013c3:	89 04 24             	mov    %eax,(%esp)
801013c6:	e8 49 ff ff ff       	call   80101314 <readsb>
  for(b = 0; b < sb.size; b += BPB){
801013cb:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
801013d2:	e9 0d 01 00 00       	jmp    801014e4 <balloc+0x139>
    bp = bread(dev, BBLOCK(b, sb.ninodes));
801013d7:	8b 45 f4             	mov    -0xc(%ebp),%eax
801013da:	8d 90 ff 0f 00 00    	lea    0xfff(%eax),%edx
801013e0:	85 c0                	test   %eax,%eax
801013e2:	0f 48 c2             	cmovs  %edx,%eax
801013e5:	c1 f8 0c             	sar    $0xc,%eax
801013e8:	8b 55 e0             	mov    -0x20(%ebp),%edx
801013eb:	c1 ea 03             	shr    $0x3,%edx
801013ee:	01 d0                	add    %edx,%eax
801013f0:	83 c0 03             	add    $0x3,%eax
801013f3:	89 44 24 04          	mov    %eax,0x4(%esp)
801013f7:	8b 45 08             	mov    0x8(%ebp),%eax
801013fa:	89 04 24             	mov    %eax,(%esp)
801013fd:	e8 a4 ed ff ff       	call   801001a6 <bread>
80101402:	89 45 ec             	mov    %eax,-0x14(%ebp)
    for(bi = 0; bi < BPB && b + bi < sb.size; bi++){
80101405:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
8010140c:	e9 a3 00 00 00       	jmp    801014b4 <balloc+0x109>
      m = 1 << (bi % 8);
80101411:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101414:	89 c2                	mov    %eax,%edx
80101416:	c1 fa 1f             	sar    $0x1f,%edx
80101419:	c1 ea 1d             	shr    $0x1d,%edx
8010141c:	01 d0                	add    %edx,%eax
8010141e:	83 e0 07             	and    $0x7,%eax
80101421:	29 d0                	sub    %edx,%eax
80101423:	ba 01 00 00 00       	mov    $0x1,%edx
80101428:	89 d3                	mov    %edx,%ebx
8010142a:	89 c1                	mov    %eax,%ecx
8010142c:	d3 e3                	shl    %cl,%ebx
8010142e:	89 d8                	mov    %ebx,%eax
80101430:	89 45 e8             	mov    %eax,-0x18(%ebp)
      if((bp->data[bi/8] & m) == 0){  // Is block free?
80101433:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101436:	8d 50 07             	lea    0x7(%eax),%edx
80101439:	85 c0                	test   %eax,%eax
8010143b:	0f 48 c2             	cmovs  %edx,%eax
8010143e:	c1 f8 03             	sar    $0x3,%eax
80101441:	8b 55 ec             	mov    -0x14(%ebp),%edx
80101444:	0f b6 44 02 18       	movzbl 0x18(%edx,%eax,1),%eax
80101449:	0f b6 c0             	movzbl %al,%eax
8010144c:	23 45 e8             	and    -0x18(%ebp),%eax
8010144f:	85 c0                	test   %eax,%eax
80101451:	75 5d                	jne    801014b0 <balloc+0x105>
        bp->data[bi/8] |= m;  // Mark block in use.
80101453:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101456:	8d 50 07             	lea    0x7(%eax),%edx
80101459:	85 c0                	test   %eax,%eax
8010145b:	0f 48 c2             	cmovs  %edx,%eax
8010145e:	c1 f8 03             	sar    $0x3,%eax
80101461:	8b 55 ec             	mov    -0x14(%ebp),%edx
80101464:	0f b6 54 02 18       	movzbl 0x18(%edx,%eax,1),%edx
80101469:	89 d1                	mov    %edx,%ecx
8010146b:	8b 55 e8             	mov    -0x18(%ebp),%edx
8010146e:	09 ca                	or     %ecx,%edx
80101470:	89 d1                	mov    %edx,%ecx
80101472:	8b 55 ec             	mov    -0x14(%ebp),%edx
80101475:	88 4c 02 18          	mov    %cl,0x18(%edx,%eax,1)
        log_write(bp);
80101479:	8b 45 ec             	mov    -0x14(%ebp),%eax
8010147c:	89 04 24             	mov    %eax,(%esp)
8010147f:	e8 8d 1e 00 00       	call   80103311 <log_write>
        brelse(bp);
80101484:	8b 45 ec             	mov    -0x14(%ebp),%eax
80101487:	89 04 24             	mov    %eax,(%esp)
8010148a:	e8 88 ed ff ff       	call   80100217 <brelse>
        bzero(dev, b + bi);
8010148f:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101492:	8b 55 f4             	mov    -0xc(%ebp),%edx
80101495:	01 c2                	add    %eax,%edx
80101497:	8b 45 08             	mov    0x8(%ebp),%eax
8010149a:	89 54 24 04          	mov    %edx,0x4(%esp)
8010149e:	89 04 24             	mov    %eax,(%esp)
801014a1:	e8 b4 fe ff ff       	call   8010135a <bzero>
        return b + bi;
801014a6:	8b 45 f0             	mov    -0x10(%ebp),%eax
801014a9:	8b 55 f4             	mov    -0xc(%ebp),%edx
801014ac:	01 d0                	add    %edx,%eax
801014ae:	eb 4e                	jmp    801014fe <balloc+0x153>

  bp = 0;
  readsb(dev, &sb);
  for(b = 0; b < sb.size; b += BPB){
    bp = bread(dev, BBLOCK(b, sb.ninodes));
    for(bi = 0; bi < BPB && b + bi < sb.size; bi++){
801014b0:	83 45 f0 01          	addl   $0x1,-0x10(%ebp)
801014b4:	81 7d f0 ff 0f 00 00 	cmpl   $0xfff,-0x10(%ebp)
801014bb:	7f 15                	jg     801014d2 <balloc+0x127>
801014bd:	8b 45 f0             	mov    -0x10(%ebp),%eax
801014c0:	8b 55 f4             	mov    -0xc(%ebp),%edx
801014c3:	01 d0                	add    %edx,%eax
801014c5:	89 c2                	mov    %eax,%edx
801014c7:	8b 45 d8             	mov    -0x28(%ebp),%eax
801014ca:	39 c2                	cmp    %eax,%edx
801014cc:	0f 82 3f ff ff ff    	jb     80101411 <balloc+0x66>
        brelse(bp);
        bzero(dev, b + bi);
        return b + bi;
      }
    }
    brelse(bp);
801014d2:	8b 45 ec             	mov    -0x14(%ebp),%eax
801014d5:	89 04 24             	mov    %eax,(%esp)
801014d8:	e8 3a ed ff ff       	call   80100217 <brelse>
  struct buf *bp;
  struct superblock sb;

  bp = 0;
  readsb(dev, &sb);
  for(b = 0; b < sb.size; b += BPB){
801014dd:	81 45 f4 00 10 00 00 	addl   $0x1000,-0xc(%ebp)
801014e4:	8b 55 f4             	mov    -0xc(%ebp),%edx
801014e7:	8b 45 d8             	mov    -0x28(%ebp),%eax
801014ea:	39 c2                	cmp    %eax,%edx
801014ec:	0f 82 e5 fe ff ff    	jb     801013d7 <balloc+0x2c>
        return b + bi;
      }
    }
    brelse(bp);
  }
  panic("balloc: out of blocks");
801014f2:	c7 04 24 95 87 10 80 	movl   $0x80108795,(%esp)
801014f9:	e8 48 f0 ff ff       	call   80100546 <panic>
}
801014fe:	83 c4 34             	add    $0x34,%esp
80101501:	5b                   	pop    %ebx
80101502:	5d                   	pop    %ebp
80101503:	c3                   	ret    

80101504 <bfree>:

// Free a disk block.
static void
bfree(int dev, uint b)
{
80101504:	55                   	push   %ebp
80101505:	89 e5                	mov    %esp,%ebp
80101507:	53                   	push   %ebx
80101508:	83 ec 34             	sub    $0x34,%esp
  struct buf *bp;
  struct superblock sb;
  int bi, m;

  readsb(dev, &sb);
8010150b:	8d 45 dc             	lea    -0x24(%ebp),%eax
8010150e:	89 44 24 04          	mov    %eax,0x4(%esp)
80101512:	8b 45 08             	mov    0x8(%ebp),%eax
80101515:	89 04 24             	mov    %eax,(%esp)
80101518:	e8 f7 fd ff ff       	call   80101314 <readsb>
  bp = bread(dev, BBLOCK(b, sb.ninodes));
8010151d:	8b 45 0c             	mov    0xc(%ebp),%eax
80101520:	89 c2                	mov    %eax,%edx
80101522:	c1 ea 0c             	shr    $0xc,%edx
80101525:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80101528:	c1 e8 03             	shr    $0x3,%eax
8010152b:	01 d0                	add    %edx,%eax
8010152d:	8d 50 03             	lea    0x3(%eax),%edx
80101530:	8b 45 08             	mov    0x8(%ebp),%eax
80101533:	89 54 24 04          	mov    %edx,0x4(%esp)
80101537:	89 04 24             	mov    %eax,(%esp)
8010153a:	e8 67 ec ff ff       	call   801001a6 <bread>
8010153f:	89 45 f4             	mov    %eax,-0xc(%ebp)
  bi = b % BPB;
80101542:	8b 45 0c             	mov    0xc(%ebp),%eax
80101545:	25 ff 0f 00 00       	and    $0xfff,%eax
8010154a:	89 45 f0             	mov    %eax,-0x10(%ebp)
  m = 1 << (bi % 8);
8010154d:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101550:	89 c2                	mov    %eax,%edx
80101552:	c1 fa 1f             	sar    $0x1f,%edx
80101555:	c1 ea 1d             	shr    $0x1d,%edx
80101558:	01 d0                	add    %edx,%eax
8010155a:	83 e0 07             	and    $0x7,%eax
8010155d:	29 d0                	sub    %edx,%eax
8010155f:	ba 01 00 00 00       	mov    $0x1,%edx
80101564:	89 d3                	mov    %edx,%ebx
80101566:	89 c1                	mov    %eax,%ecx
80101568:	d3 e3                	shl    %cl,%ebx
8010156a:	89 d8                	mov    %ebx,%eax
8010156c:	89 45 ec             	mov    %eax,-0x14(%ebp)
  if((bp->data[bi/8] & m) == 0)
8010156f:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101572:	8d 50 07             	lea    0x7(%eax),%edx
80101575:	85 c0                	test   %eax,%eax
80101577:	0f 48 c2             	cmovs  %edx,%eax
8010157a:	c1 f8 03             	sar    $0x3,%eax
8010157d:	8b 55 f4             	mov    -0xc(%ebp),%edx
80101580:	0f b6 44 02 18       	movzbl 0x18(%edx,%eax,1),%eax
80101585:	0f b6 c0             	movzbl %al,%eax
80101588:	23 45 ec             	and    -0x14(%ebp),%eax
8010158b:	85 c0                	test   %eax,%eax
8010158d:	75 0c                	jne    8010159b <bfree+0x97>
    panic("freeing free block");
8010158f:	c7 04 24 ab 87 10 80 	movl   $0x801087ab,(%esp)
80101596:	e8 ab ef ff ff       	call   80100546 <panic>
  bp->data[bi/8] &= ~m;
8010159b:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010159e:	8d 50 07             	lea    0x7(%eax),%edx
801015a1:	85 c0                	test   %eax,%eax
801015a3:	0f 48 c2             	cmovs  %edx,%eax
801015a6:	c1 f8 03             	sar    $0x3,%eax
801015a9:	8b 55 f4             	mov    -0xc(%ebp),%edx
801015ac:	0f b6 54 02 18       	movzbl 0x18(%edx,%eax,1),%edx
801015b1:	8b 4d ec             	mov    -0x14(%ebp),%ecx
801015b4:	f7 d1                	not    %ecx
801015b6:	21 ca                	and    %ecx,%edx
801015b8:	89 d1                	mov    %edx,%ecx
801015ba:	8b 55 f4             	mov    -0xc(%ebp),%edx
801015bd:	88 4c 02 18          	mov    %cl,0x18(%edx,%eax,1)
  log_write(bp);
801015c1:	8b 45 f4             	mov    -0xc(%ebp),%eax
801015c4:	89 04 24             	mov    %eax,(%esp)
801015c7:	e8 45 1d 00 00       	call   80103311 <log_write>
  brelse(bp);
801015cc:	8b 45 f4             	mov    -0xc(%ebp),%eax
801015cf:	89 04 24             	mov    %eax,(%esp)
801015d2:	e8 40 ec ff ff       	call   80100217 <brelse>
}
801015d7:	83 c4 34             	add    $0x34,%esp
801015da:	5b                   	pop    %ebx
801015db:	5d                   	pop    %ebp
801015dc:	c3                   	ret    

801015dd <iinit>:
  struct inode inode[NINODE];
} icache;

void
iinit(void)
{
801015dd:	55                   	push   %ebp
801015de:	89 e5                	mov    %esp,%ebp
801015e0:	83 ec 18             	sub    $0x18,%esp
  initlock(&icache.lock, "icache");
801015e3:	c7 44 24 04 be 87 10 	movl   $0x801087be,0x4(%esp)
801015ea:	80 
801015eb:	c7 04 24 a0 e8 10 80 	movl   $0x8010e8a0,(%esp)
801015f2:	e8 ff 39 00 00       	call   80104ff6 <initlock>
}
801015f7:	c9                   	leave  
801015f8:	c3                   	ret    

801015f9 <ialloc>:
//PAGEBREAK!
// Allocate a new inode with the given type on device dev.
// A free inode has a type of zero.
struct inode*
ialloc(uint dev, short type)
{
801015f9:	55                   	push   %ebp
801015fa:	89 e5                	mov    %esp,%ebp
801015fc:	83 ec 48             	sub    $0x48,%esp
801015ff:	8b 45 0c             	mov    0xc(%ebp),%eax
80101602:	66 89 45 d4          	mov    %ax,-0x2c(%ebp)
  int inum;
  struct buf *bp;
  struct dinode *dip;
  struct superblock sb;

  readsb(dev, &sb);
80101606:	8b 45 08             	mov    0x8(%ebp),%eax
80101609:	8d 55 dc             	lea    -0x24(%ebp),%edx
8010160c:	89 54 24 04          	mov    %edx,0x4(%esp)
80101610:	89 04 24             	mov    %eax,(%esp)
80101613:	e8 fc fc ff ff       	call   80101314 <readsb>

  for(inum = 1; inum < sb.ninodes; inum++){
80101618:	c7 45 f4 01 00 00 00 	movl   $0x1,-0xc(%ebp)
8010161f:	e9 98 00 00 00       	jmp    801016bc <ialloc+0xc3>
    bp = bread(dev, IBLOCK(inum));
80101624:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101627:	c1 e8 03             	shr    $0x3,%eax
8010162a:	83 c0 02             	add    $0x2,%eax
8010162d:	89 44 24 04          	mov    %eax,0x4(%esp)
80101631:	8b 45 08             	mov    0x8(%ebp),%eax
80101634:	89 04 24             	mov    %eax,(%esp)
80101637:	e8 6a eb ff ff       	call   801001a6 <bread>
8010163c:	89 45 f0             	mov    %eax,-0x10(%ebp)
    dip = (struct dinode*)bp->data + inum%IPB;
8010163f:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101642:	8d 50 18             	lea    0x18(%eax),%edx
80101645:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101648:	83 e0 07             	and    $0x7,%eax
8010164b:	c1 e0 06             	shl    $0x6,%eax
8010164e:	01 d0                	add    %edx,%eax
80101650:	89 45 ec             	mov    %eax,-0x14(%ebp)
    if(dip->type == 0){  // a free inode
80101653:	8b 45 ec             	mov    -0x14(%ebp),%eax
80101656:	0f b7 00             	movzwl (%eax),%eax
80101659:	66 85 c0             	test   %ax,%ax
8010165c:	75 4f                	jne    801016ad <ialloc+0xb4>
      memset(dip, 0, sizeof(*dip));
8010165e:	c7 44 24 08 40 00 00 	movl   $0x40,0x8(%esp)
80101665:	00 
80101666:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
8010166d:	00 
8010166e:	8b 45 ec             	mov    -0x14(%ebp),%eax
80101671:	89 04 24             	mov    %eax,(%esp)
80101674:	e8 f9 3b 00 00       	call   80105272 <memset>
      dip->type = type;
80101679:	8b 45 ec             	mov    -0x14(%ebp),%eax
8010167c:	0f b7 55 d4          	movzwl -0x2c(%ebp),%edx
80101680:	66 89 10             	mov    %dx,(%eax)
      log_write(bp);   // mark it allocated on the disk
80101683:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101686:	89 04 24             	mov    %eax,(%esp)
80101689:	e8 83 1c 00 00       	call   80103311 <log_write>
      brelse(bp);
8010168e:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101691:	89 04 24             	mov    %eax,(%esp)
80101694:	e8 7e eb ff ff       	call   80100217 <brelse>
      return iget(dev, inum);
80101699:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010169c:	89 44 24 04          	mov    %eax,0x4(%esp)
801016a0:	8b 45 08             	mov    0x8(%ebp),%eax
801016a3:	89 04 24             	mov    %eax,(%esp)
801016a6:	e8 e5 00 00 00       	call   80101790 <iget>
801016ab:	eb 29                	jmp    801016d6 <ialloc+0xdd>
    }
    brelse(bp);
801016ad:	8b 45 f0             	mov    -0x10(%ebp),%eax
801016b0:	89 04 24             	mov    %eax,(%esp)
801016b3:	e8 5f eb ff ff       	call   80100217 <brelse>
  struct dinode *dip;
  struct superblock sb;

  readsb(dev, &sb);

  for(inum = 1; inum < sb.ninodes; inum++){
801016b8:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
801016bc:	8b 55 f4             	mov    -0xc(%ebp),%edx
801016bf:	8b 45 e4             	mov    -0x1c(%ebp),%eax
801016c2:	39 c2                	cmp    %eax,%edx
801016c4:	0f 82 5a ff ff ff    	jb     80101624 <ialloc+0x2b>
      brelse(bp);
      return iget(dev, inum);
    }
    brelse(bp);
  }
  panic("ialloc: no inodes");
801016ca:	c7 04 24 c5 87 10 80 	movl   $0x801087c5,(%esp)
801016d1:	e8 70 ee ff ff       	call   80100546 <panic>
}
801016d6:	c9                   	leave  
801016d7:	c3                   	ret    

801016d8 <iupdate>:

// Copy a modified in-memory inode to disk.
void
iupdate(struct inode *ip)
{
801016d8:	55                   	push   %ebp
801016d9:	89 e5                	mov    %esp,%ebp
801016db:	83 ec 28             	sub    $0x28,%esp
  struct buf *bp;
  struct dinode *dip;

  bp = bread(ip->dev, IBLOCK(ip->inum));
801016de:	8b 45 08             	mov    0x8(%ebp),%eax
801016e1:	8b 40 04             	mov    0x4(%eax),%eax
801016e4:	c1 e8 03             	shr    $0x3,%eax
801016e7:	8d 50 02             	lea    0x2(%eax),%edx
801016ea:	8b 45 08             	mov    0x8(%ebp),%eax
801016ed:	8b 00                	mov    (%eax),%eax
801016ef:	89 54 24 04          	mov    %edx,0x4(%esp)
801016f3:	89 04 24             	mov    %eax,(%esp)
801016f6:	e8 ab ea ff ff       	call   801001a6 <bread>
801016fb:	89 45 f4             	mov    %eax,-0xc(%ebp)
  dip = (struct dinode*)bp->data + ip->inum%IPB;
801016fe:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101701:	8d 50 18             	lea    0x18(%eax),%edx
80101704:	8b 45 08             	mov    0x8(%ebp),%eax
80101707:	8b 40 04             	mov    0x4(%eax),%eax
8010170a:	83 e0 07             	and    $0x7,%eax
8010170d:	c1 e0 06             	shl    $0x6,%eax
80101710:	01 d0                	add    %edx,%eax
80101712:	89 45 f0             	mov    %eax,-0x10(%ebp)
  dip->type = ip->type;
80101715:	8b 45 08             	mov    0x8(%ebp),%eax
80101718:	0f b7 50 10          	movzwl 0x10(%eax),%edx
8010171c:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010171f:	66 89 10             	mov    %dx,(%eax)
  dip->major = ip->major;
80101722:	8b 45 08             	mov    0x8(%ebp),%eax
80101725:	0f b7 50 12          	movzwl 0x12(%eax),%edx
80101729:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010172c:	66 89 50 02          	mov    %dx,0x2(%eax)
  dip->minor = ip->minor;
80101730:	8b 45 08             	mov    0x8(%ebp),%eax
80101733:	0f b7 50 14          	movzwl 0x14(%eax),%edx
80101737:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010173a:	66 89 50 04          	mov    %dx,0x4(%eax)
  dip->nlink = ip->nlink;
8010173e:	8b 45 08             	mov    0x8(%ebp),%eax
80101741:	0f b7 50 16          	movzwl 0x16(%eax),%edx
80101745:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101748:	66 89 50 06          	mov    %dx,0x6(%eax)
  dip->size = ip->size;
8010174c:	8b 45 08             	mov    0x8(%ebp),%eax
8010174f:	8b 50 18             	mov    0x18(%eax),%edx
80101752:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101755:	89 50 08             	mov    %edx,0x8(%eax)
  memmove(dip->addrs, ip->addrs, sizeof(ip->addrs));
80101758:	8b 45 08             	mov    0x8(%ebp),%eax
8010175b:	8d 50 1c             	lea    0x1c(%eax),%edx
8010175e:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101761:	83 c0 0c             	add    $0xc,%eax
80101764:	c7 44 24 08 34 00 00 	movl   $0x34,0x8(%esp)
8010176b:	00 
8010176c:	89 54 24 04          	mov    %edx,0x4(%esp)
80101770:	89 04 24             	mov    %eax,(%esp)
80101773:	e8 cd 3b 00 00       	call   80105345 <memmove>
  log_write(bp);
80101778:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010177b:	89 04 24             	mov    %eax,(%esp)
8010177e:	e8 8e 1b 00 00       	call   80103311 <log_write>
  brelse(bp);
80101783:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101786:	89 04 24             	mov    %eax,(%esp)
80101789:	e8 89 ea ff ff       	call   80100217 <brelse>
}
8010178e:	c9                   	leave  
8010178f:	c3                   	ret    

80101790 <iget>:
// Find the inode with number inum on device dev
// and return the in-memory copy. Does not lock
// the inode and does not read it from disk.
static struct inode*
iget(uint dev, uint inum)
{
80101790:	55                   	push   %ebp
80101791:	89 e5                	mov    %esp,%ebp
80101793:	83 ec 28             	sub    $0x28,%esp
  struct inode *ip, *empty;

  acquire(&icache.lock);
80101796:	c7 04 24 a0 e8 10 80 	movl   $0x8010e8a0,(%esp)
8010179d:	e8 75 38 00 00       	call   80105017 <acquire>

  // Is the inode already cached?
  empty = 0;
801017a2:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
  for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){
801017a9:	c7 45 f4 d4 e8 10 80 	movl   $0x8010e8d4,-0xc(%ebp)
801017b0:	eb 59                	jmp    8010180b <iget+0x7b>
    if(ip->ref > 0 && ip->dev == dev && ip->inum == inum){
801017b2:	8b 45 f4             	mov    -0xc(%ebp),%eax
801017b5:	8b 40 08             	mov    0x8(%eax),%eax
801017b8:	85 c0                	test   %eax,%eax
801017ba:	7e 35                	jle    801017f1 <iget+0x61>
801017bc:	8b 45 f4             	mov    -0xc(%ebp),%eax
801017bf:	8b 00                	mov    (%eax),%eax
801017c1:	3b 45 08             	cmp    0x8(%ebp),%eax
801017c4:	75 2b                	jne    801017f1 <iget+0x61>
801017c6:	8b 45 f4             	mov    -0xc(%ebp),%eax
801017c9:	8b 40 04             	mov    0x4(%eax),%eax
801017cc:	3b 45 0c             	cmp    0xc(%ebp),%eax
801017cf:	75 20                	jne    801017f1 <iget+0x61>
      ip->ref++;
801017d1:	8b 45 f4             	mov    -0xc(%ebp),%eax
801017d4:	8b 40 08             	mov    0x8(%eax),%eax
801017d7:	8d 50 01             	lea    0x1(%eax),%edx
801017da:	8b 45 f4             	mov    -0xc(%ebp),%eax
801017dd:	89 50 08             	mov    %edx,0x8(%eax)
      release(&icache.lock);
801017e0:	c7 04 24 a0 e8 10 80 	movl   $0x8010e8a0,(%esp)
801017e7:	e8 8d 38 00 00       	call   80105079 <release>
      return ip;
801017ec:	8b 45 f4             	mov    -0xc(%ebp),%eax
801017ef:	eb 6f                	jmp    80101860 <iget+0xd0>
    }
    if(empty == 0 && ip->ref == 0)    // Remember empty slot.
801017f1:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
801017f5:	75 10                	jne    80101807 <iget+0x77>
801017f7:	8b 45 f4             	mov    -0xc(%ebp),%eax
801017fa:	8b 40 08             	mov    0x8(%eax),%eax
801017fd:	85 c0                	test   %eax,%eax
801017ff:	75 06                	jne    80101807 <iget+0x77>
      empty = ip;
80101801:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101804:	89 45 f0             	mov    %eax,-0x10(%ebp)

  acquire(&icache.lock);

  // Is the inode already cached?
  empty = 0;
  for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){
80101807:	83 45 f4 50          	addl   $0x50,-0xc(%ebp)
8010180b:	81 7d f4 74 f8 10 80 	cmpl   $0x8010f874,-0xc(%ebp)
80101812:	72 9e                	jb     801017b2 <iget+0x22>
    if(empty == 0 && ip->ref == 0)    // Remember empty slot.
      empty = ip;
  }

  // Recycle an inode cache entry.
  if(empty == 0)
80101814:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
80101818:	75 0c                	jne    80101826 <iget+0x96>
    panic("iget: no inodes");
8010181a:	c7 04 24 d7 87 10 80 	movl   $0x801087d7,(%esp)
80101821:	e8 20 ed ff ff       	call   80100546 <panic>

  ip = empty;
80101826:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101829:	89 45 f4             	mov    %eax,-0xc(%ebp)
  ip->dev = dev;
8010182c:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010182f:	8b 55 08             	mov    0x8(%ebp),%edx
80101832:	89 10                	mov    %edx,(%eax)
  ip->inum = inum;
80101834:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101837:	8b 55 0c             	mov    0xc(%ebp),%edx
8010183a:	89 50 04             	mov    %edx,0x4(%eax)
  ip->ref = 1;
8010183d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101840:	c7 40 08 01 00 00 00 	movl   $0x1,0x8(%eax)
  ip->flags = 0;
80101847:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010184a:	c7 40 0c 00 00 00 00 	movl   $0x0,0xc(%eax)
  release(&icache.lock);
80101851:	c7 04 24 a0 e8 10 80 	movl   $0x8010e8a0,(%esp)
80101858:	e8 1c 38 00 00       	call   80105079 <release>

  return ip;
8010185d:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
80101860:	c9                   	leave  
80101861:	c3                   	ret    

80101862 <idup>:

// Increment reference count for ip.
// Returns ip to enable ip = idup(ip1) idiom.
struct inode*
idup(struct inode *ip)
{
80101862:	55                   	push   %ebp
80101863:	89 e5                	mov    %esp,%ebp
80101865:	83 ec 18             	sub    $0x18,%esp
  acquire(&icache.lock);
80101868:	c7 04 24 a0 e8 10 80 	movl   $0x8010e8a0,(%esp)
8010186f:	e8 a3 37 00 00       	call   80105017 <acquire>
  ip->ref++;
80101874:	8b 45 08             	mov    0x8(%ebp),%eax
80101877:	8b 40 08             	mov    0x8(%eax),%eax
8010187a:	8d 50 01             	lea    0x1(%eax),%edx
8010187d:	8b 45 08             	mov    0x8(%ebp),%eax
80101880:	89 50 08             	mov    %edx,0x8(%eax)
  release(&icache.lock);
80101883:	c7 04 24 a0 e8 10 80 	movl   $0x8010e8a0,(%esp)
8010188a:	e8 ea 37 00 00       	call   80105079 <release>
  return ip;
8010188f:	8b 45 08             	mov    0x8(%ebp),%eax
}
80101892:	c9                   	leave  
80101893:	c3                   	ret    

80101894 <ilock>:

// Lock the given inode.
// Reads the inode from disk if necessary.
void
ilock(struct inode *ip)
{
80101894:	55                   	push   %ebp
80101895:	89 e5                	mov    %esp,%ebp
80101897:	83 ec 28             	sub    $0x28,%esp
  struct buf *bp;
  struct dinode *dip;

  if(ip == 0 || ip->ref < 1)
8010189a:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
8010189e:	74 0a                	je     801018aa <ilock+0x16>
801018a0:	8b 45 08             	mov    0x8(%ebp),%eax
801018a3:	8b 40 08             	mov    0x8(%eax),%eax
801018a6:	85 c0                	test   %eax,%eax
801018a8:	7f 0c                	jg     801018b6 <ilock+0x22>
    panic("ilock");
801018aa:	c7 04 24 e7 87 10 80 	movl   $0x801087e7,(%esp)
801018b1:	e8 90 ec ff ff       	call   80100546 <panic>

  acquire(&icache.lock);
801018b6:	c7 04 24 a0 e8 10 80 	movl   $0x8010e8a0,(%esp)
801018bd:	e8 55 37 00 00       	call   80105017 <acquire>
  while(ip->flags & I_BUSY)
801018c2:	eb 13                	jmp    801018d7 <ilock+0x43>
    sleep(ip, &icache.lock);
801018c4:	c7 44 24 04 a0 e8 10 	movl   $0x8010e8a0,0x4(%esp)
801018cb:	80 
801018cc:	8b 45 08             	mov    0x8(%ebp),%eax
801018cf:	89 04 24             	mov    %eax,(%esp)
801018d2:	e8 6b 31 00 00       	call   80104a42 <sleep>

  if(ip == 0 || ip->ref < 1)
    panic("ilock");

  acquire(&icache.lock);
  while(ip->flags & I_BUSY)
801018d7:	8b 45 08             	mov    0x8(%ebp),%eax
801018da:	8b 40 0c             	mov    0xc(%eax),%eax
801018dd:	83 e0 01             	and    $0x1,%eax
801018e0:	85 c0                	test   %eax,%eax
801018e2:	75 e0                	jne    801018c4 <ilock+0x30>
    sleep(ip, &icache.lock);
  ip->flags |= I_BUSY;
801018e4:	8b 45 08             	mov    0x8(%ebp),%eax
801018e7:	8b 40 0c             	mov    0xc(%eax),%eax
801018ea:	89 c2                	mov    %eax,%edx
801018ec:	83 ca 01             	or     $0x1,%edx
801018ef:	8b 45 08             	mov    0x8(%ebp),%eax
801018f2:	89 50 0c             	mov    %edx,0xc(%eax)
  release(&icache.lock);
801018f5:	c7 04 24 a0 e8 10 80 	movl   $0x8010e8a0,(%esp)
801018fc:	e8 78 37 00 00       	call   80105079 <release>

  if(!(ip->flags & I_VALID)){
80101901:	8b 45 08             	mov    0x8(%ebp),%eax
80101904:	8b 40 0c             	mov    0xc(%eax),%eax
80101907:	83 e0 02             	and    $0x2,%eax
8010190a:	85 c0                	test   %eax,%eax
8010190c:	0f 85 ce 00 00 00    	jne    801019e0 <ilock+0x14c>
    bp = bread(ip->dev, IBLOCK(ip->inum));
80101912:	8b 45 08             	mov    0x8(%ebp),%eax
80101915:	8b 40 04             	mov    0x4(%eax),%eax
80101918:	c1 e8 03             	shr    $0x3,%eax
8010191b:	8d 50 02             	lea    0x2(%eax),%edx
8010191e:	8b 45 08             	mov    0x8(%ebp),%eax
80101921:	8b 00                	mov    (%eax),%eax
80101923:	89 54 24 04          	mov    %edx,0x4(%esp)
80101927:	89 04 24             	mov    %eax,(%esp)
8010192a:	e8 77 e8 ff ff       	call   801001a6 <bread>
8010192f:	89 45 f4             	mov    %eax,-0xc(%ebp)
    dip = (struct dinode*)bp->data + ip->inum%IPB;
80101932:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101935:	8d 50 18             	lea    0x18(%eax),%edx
80101938:	8b 45 08             	mov    0x8(%ebp),%eax
8010193b:	8b 40 04             	mov    0x4(%eax),%eax
8010193e:	83 e0 07             	and    $0x7,%eax
80101941:	c1 e0 06             	shl    $0x6,%eax
80101944:	01 d0                	add    %edx,%eax
80101946:	89 45 f0             	mov    %eax,-0x10(%ebp)
    ip->type = dip->type;
80101949:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010194c:	0f b7 10             	movzwl (%eax),%edx
8010194f:	8b 45 08             	mov    0x8(%ebp),%eax
80101952:	66 89 50 10          	mov    %dx,0x10(%eax)
    ip->major = dip->major;
80101956:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101959:	0f b7 50 02          	movzwl 0x2(%eax),%edx
8010195d:	8b 45 08             	mov    0x8(%ebp),%eax
80101960:	66 89 50 12          	mov    %dx,0x12(%eax)
    ip->minor = dip->minor;
80101964:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101967:	0f b7 50 04          	movzwl 0x4(%eax),%edx
8010196b:	8b 45 08             	mov    0x8(%ebp),%eax
8010196e:	66 89 50 14          	mov    %dx,0x14(%eax)
    ip->nlink = dip->nlink;
80101972:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101975:	0f b7 50 06          	movzwl 0x6(%eax),%edx
80101979:	8b 45 08             	mov    0x8(%ebp),%eax
8010197c:	66 89 50 16          	mov    %dx,0x16(%eax)
    ip->size = dip->size;
80101980:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101983:	8b 50 08             	mov    0x8(%eax),%edx
80101986:	8b 45 08             	mov    0x8(%ebp),%eax
80101989:	89 50 18             	mov    %edx,0x18(%eax)
    memmove(ip->addrs, dip->addrs, sizeof(ip->addrs));
8010198c:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010198f:	8d 50 0c             	lea    0xc(%eax),%edx
80101992:	8b 45 08             	mov    0x8(%ebp),%eax
80101995:	83 c0 1c             	add    $0x1c,%eax
80101998:	c7 44 24 08 34 00 00 	movl   $0x34,0x8(%esp)
8010199f:	00 
801019a0:	89 54 24 04          	mov    %edx,0x4(%esp)
801019a4:	89 04 24             	mov    %eax,(%esp)
801019a7:	e8 99 39 00 00       	call   80105345 <memmove>
    brelse(bp);
801019ac:	8b 45 f4             	mov    -0xc(%ebp),%eax
801019af:	89 04 24             	mov    %eax,(%esp)
801019b2:	e8 60 e8 ff ff       	call   80100217 <brelse>
    ip->flags |= I_VALID;
801019b7:	8b 45 08             	mov    0x8(%ebp),%eax
801019ba:	8b 40 0c             	mov    0xc(%eax),%eax
801019bd:	89 c2                	mov    %eax,%edx
801019bf:	83 ca 02             	or     $0x2,%edx
801019c2:	8b 45 08             	mov    0x8(%ebp),%eax
801019c5:	89 50 0c             	mov    %edx,0xc(%eax)
    if(ip->type == 0)
801019c8:	8b 45 08             	mov    0x8(%ebp),%eax
801019cb:	0f b7 40 10          	movzwl 0x10(%eax),%eax
801019cf:	66 85 c0             	test   %ax,%ax
801019d2:	75 0c                	jne    801019e0 <ilock+0x14c>
      panic("ilock: no type");
801019d4:	c7 04 24 ed 87 10 80 	movl   $0x801087ed,(%esp)
801019db:	e8 66 eb ff ff       	call   80100546 <panic>
  }
}
801019e0:	c9                   	leave  
801019e1:	c3                   	ret    

801019e2 <iunlock>:

// Unlock the given inode.
void
iunlock(struct inode *ip)
{
801019e2:	55                   	push   %ebp
801019e3:	89 e5                	mov    %esp,%ebp
801019e5:	83 ec 18             	sub    $0x18,%esp
  if(ip == 0 || !(ip->flags & I_BUSY) || ip->ref < 1)
801019e8:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
801019ec:	74 17                	je     80101a05 <iunlock+0x23>
801019ee:	8b 45 08             	mov    0x8(%ebp),%eax
801019f1:	8b 40 0c             	mov    0xc(%eax),%eax
801019f4:	83 e0 01             	and    $0x1,%eax
801019f7:	85 c0                	test   %eax,%eax
801019f9:	74 0a                	je     80101a05 <iunlock+0x23>
801019fb:	8b 45 08             	mov    0x8(%ebp),%eax
801019fe:	8b 40 08             	mov    0x8(%eax),%eax
80101a01:	85 c0                	test   %eax,%eax
80101a03:	7f 0c                	jg     80101a11 <iunlock+0x2f>
    panic("iunlock");
80101a05:	c7 04 24 fc 87 10 80 	movl   $0x801087fc,(%esp)
80101a0c:	e8 35 eb ff ff       	call   80100546 <panic>

  acquire(&icache.lock);
80101a11:	c7 04 24 a0 e8 10 80 	movl   $0x8010e8a0,(%esp)
80101a18:	e8 fa 35 00 00       	call   80105017 <acquire>
  ip->flags &= ~I_BUSY;
80101a1d:	8b 45 08             	mov    0x8(%ebp),%eax
80101a20:	8b 40 0c             	mov    0xc(%eax),%eax
80101a23:	89 c2                	mov    %eax,%edx
80101a25:	83 e2 fe             	and    $0xfffffffe,%edx
80101a28:	8b 45 08             	mov    0x8(%ebp),%eax
80101a2b:	89 50 0c             	mov    %edx,0xc(%eax)
  wakeup(ip);
80101a2e:	8b 45 08             	mov    0x8(%ebp),%eax
80101a31:	89 04 24             	mov    %eax,(%esp)
80101a34:	e8 e5 30 00 00       	call   80104b1e <wakeup>
  release(&icache.lock);
80101a39:	c7 04 24 a0 e8 10 80 	movl   $0x8010e8a0,(%esp)
80101a40:	e8 34 36 00 00       	call   80105079 <release>
}
80101a45:	c9                   	leave  
80101a46:	c3                   	ret    

80101a47 <iput>:
// be recycled.
// If that was the last reference and the inode has no links
// to it, free the inode (and its content) on disk.
void
iput(struct inode *ip)
{
80101a47:	55                   	push   %ebp
80101a48:	89 e5                	mov    %esp,%ebp
80101a4a:	83 ec 18             	sub    $0x18,%esp
  acquire(&icache.lock);
80101a4d:	c7 04 24 a0 e8 10 80 	movl   $0x8010e8a0,(%esp)
80101a54:	e8 be 35 00 00       	call   80105017 <acquire>
  if(ip->ref == 1 && (ip->flags & I_VALID) && ip->nlink == 0){
80101a59:	8b 45 08             	mov    0x8(%ebp),%eax
80101a5c:	8b 40 08             	mov    0x8(%eax),%eax
80101a5f:	83 f8 01             	cmp    $0x1,%eax
80101a62:	0f 85 93 00 00 00    	jne    80101afb <iput+0xb4>
80101a68:	8b 45 08             	mov    0x8(%ebp),%eax
80101a6b:	8b 40 0c             	mov    0xc(%eax),%eax
80101a6e:	83 e0 02             	and    $0x2,%eax
80101a71:	85 c0                	test   %eax,%eax
80101a73:	0f 84 82 00 00 00    	je     80101afb <iput+0xb4>
80101a79:	8b 45 08             	mov    0x8(%ebp),%eax
80101a7c:	0f b7 40 16          	movzwl 0x16(%eax),%eax
80101a80:	66 85 c0             	test   %ax,%ax
80101a83:	75 76                	jne    80101afb <iput+0xb4>
    // inode has no links: truncate and free inode.
    if(ip->flags & I_BUSY)
80101a85:	8b 45 08             	mov    0x8(%ebp),%eax
80101a88:	8b 40 0c             	mov    0xc(%eax),%eax
80101a8b:	83 e0 01             	and    $0x1,%eax
80101a8e:	85 c0                	test   %eax,%eax
80101a90:	74 0c                	je     80101a9e <iput+0x57>
      panic("iput busy");
80101a92:	c7 04 24 04 88 10 80 	movl   $0x80108804,(%esp)
80101a99:	e8 a8 ea ff ff       	call   80100546 <panic>
    ip->flags |= I_BUSY;
80101a9e:	8b 45 08             	mov    0x8(%ebp),%eax
80101aa1:	8b 40 0c             	mov    0xc(%eax),%eax
80101aa4:	89 c2                	mov    %eax,%edx
80101aa6:	83 ca 01             	or     $0x1,%edx
80101aa9:	8b 45 08             	mov    0x8(%ebp),%eax
80101aac:	89 50 0c             	mov    %edx,0xc(%eax)
    release(&icache.lock);
80101aaf:	c7 04 24 a0 e8 10 80 	movl   $0x8010e8a0,(%esp)
80101ab6:	e8 be 35 00 00       	call   80105079 <release>
    itrunc(ip);
80101abb:	8b 45 08             	mov    0x8(%ebp),%eax
80101abe:	89 04 24             	mov    %eax,(%esp)
80101ac1:	e8 7d 01 00 00       	call   80101c43 <itrunc>
    ip->type = 0;
80101ac6:	8b 45 08             	mov    0x8(%ebp),%eax
80101ac9:	66 c7 40 10 00 00    	movw   $0x0,0x10(%eax)
    iupdate(ip);
80101acf:	8b 45 08             	mov    0x8(%ebp),%eax
80101ad2:	89 04 24             	mov    %eax,(%esp)
80101ad5:	e8 fe fb ff ff       	call   801016d8 <iupdate>
    acquire(&icache.lock);
80101ada:	c7 04 24 a0 e8 10 80 	movl   $0x8010e8a0,(%esp)
80101ae1:	e8 31 35 00 00       	call   80105017 <acquire>
    ip->flags = 0;
80101ae6:	8b 45 08             	mov    0x8(%ebp),%eax
80101ae9:	c7 40 0c 00 00 00 00 	movl   $0x0,0xc(%eax)
    wakeup(ip);
80101af0:	8b 45 08             	mov    0x8(%ebp),%eax
80101af3:	89 04 24             	mov    %eax,(%esp)
80101af6:	e8 23 30 00 00       	call   80104b1e <wakeup>
  }
  ip->ref--;
80101afb:	8b 45 08             	mov    0x8(%ebp),%eax
80101afe:	8b 40 08             	mov    0x8(%eax),%eax
80101b01:	8d 50 ff             	lea    -0x1(%eax),%edx
80101b04:	8b 45 08             	mov    0x8(%ebp),%eax
80101b07:	89 50 08             	mov    %edx,0x8(%eax)
  release(&icache.lock);
80101b0a:	c7 04 24 a0 e8 10 80 	movl   $0x8010e8a0,(%esp)
80101b11:	e8 63 35 00 00       	call   80105079 <release>
}
80101b16:	c9                   	leave  
80101b17:	c3                   	ret    

80101b18 <iunlockput>:

// Common idiom: unlock, then put.
void
iunlockput(struct inode *ip)
{
80101b18:	55                   	push   %ebp
80101b19:	89 e5                	mov    %esp,%ebp
80101b1b:	83 ec 18             	sub    $0x18,%esp
  iunlock(ip);
80101b1e:	8b 45 08             	mov    0x8(%ebp),%eax
80101b21:	89 04 24             	mov    %eax,(%esp)
80101b24:	e8 b9 fe ff ff       	call   801019e2 <iunlock>
  iput(ip);
80101b29:	8b 45 08             	mov    0x8(%ebp),%eax
80101b2c:	89 04 24             	mov    %eax,(%esp)
80101b2f:	e8 13 ff ff ff       	call   80101a47 <iput>
}
80101b34:	c9                   	leave  
80101b35:	c3                   	ret    

80101b36 <bmap>:

// Return the disk block address of the nth block in inode ip.
// If there is no such block, bmap allocates one.
static uint
bmap(struct inode *ip, uint bn)
{
80101b36:	55                   	push   %ebp
80101b37:	89 e5                	mov    %esp,%ebp
80101b39:	53                   	push   %ebx
80101b3a:	83 ec 24             	sub    $0x24,%esp
  uint addr, *a;
  struct buf *bp;

  if(bn < NDIRECT){
80101b3d:	83 7d 0c 0b          	cmpl   $0xb,0xc(%ebp)
80101b41:	77 3e                	ja     80101b81 <bmap+0x4b>
    if((addr = ip->addrs[bn]) == 0)
80101b43:	8b 45 08             	mov    0x8(%ebp),%eax
80101b46:	8b 55 0c             	mov    0xc(%ebp),%edx
80101b49:	83 c2 04             	add    $0x4,%edx
80101b4c:	8b 44 90 0c          	mov    0xc(%eax,%edx,4),%eax
80101b50:	89 45 f4             	mov    %eax,-0xc(%ebp)
80101b53:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80101b57:	75 20                	jne    80101b79 <bmap+0x43>
      ip->addrs[bn] = addr = balloc(ip->dev);
80101b59:	8b 45 08             	mov    0x8(%ebp),%eax
80101b5c:	8b 00                	mov    (%eax),%eax
80101b5e:	89 04 24             	mov    %eax,(%esp)
80101b61:	e8 45 f8 ff ff       	call   801013ab <balloc>
80101b66:	89 45 f4             	mov    %eax,-0xc(%ebp)
80101b69:	8b 45 08             	mov    0x8(%ebp),%eax
80101b6c:	8b 55 0c             	mov    0xc(%ebp),%edx
80101b6f:	8d 4a 04             	lea    0x4(%edx),%ecx
80101b72:	8b 55 f4             	mov    -0xc(%ebp),%edx
80101b75:	89 54 88 0c          	mov    %edx,0xc(%eax,%ecx,4)
    return addr;
80101b79:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101b7c:	e9 bc 00 00 00       	jmp    80101c3d <bmap+0x107>
  }
  bn -= NDIRECT;
80101b81:	83 6d 0c 0c          	subl   $0xc,0xc(%ebp)

  if(bn < NINDIRECT){
80101b85:	83 7d 0c 7f          	cmpl   $0x7f,0xc(%ebp)
80101b89:	0f 87 a2 00 00 00    	ja     80101c31 <bmap+0xfb>
    // Load indirect block, allocating if necessary.
    if((addr = ip->addrs[NDIRECT]) == 0)
80101b8f:	8b 45 08             	mov    0x8(%ebp),%eax
80101b92:	8b 40 4c             	mov    0x4c(%eax),%eax
80101b95:	89 45 f4             	mov    %eax,-0xc(%ebp)
80101b98:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80101b9c:	75 19                	jne    80101bb7 <bmap+0x81>
      ip->addrs[NDIRECT] = addr = balloc(ip->dev);
80101b9e:	8b 45 08             	mov    0x8(%ebp),%eax
80101ba1:	8b 00                	mov    (%eax),%eax
80101ba3:	89 04 24             	mov    %eax,(%esp)
80101ba6:	e8 00 f8 ff ff       	call   801013ab <balloc>
80101bab:	89 45 f4             	mov    %eax,-0xc(%ebp)
80101bae:	8b 45 08             	mov    0x8(%ebp),%eax
80101bb1:	8b 55 f4             	mov    -0xc(%ebp),%edx
80101bb4:	89 50 4c             	mov    %edx,0x4c(%eax)
    bp = bread(ip->dev, addr);
80101bb7:	8b 45 08             	mov    0x8(%ebp),%eax
80101bba:	8b 00                	mov    (%eax),%eax
80101bbc:	8b 55 f4             	mov    -0xc(%ebp),%edx
80101bbf:	89 54 24 04          	mov    %edx,0x4(%esp)
80101bc3:	89 04 24             	mov    %eax,(%esp)
80101bc6:	e8 db e5 ff ff       	call   801001a6 <bread>
80101bcb:	89 45 f0             	mov    %eax,-0x10(%ebp)
    a = (uint*)bp->data;
80101bce:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101bd1:	83 c0 18             	add    $0x18,%eax
80101bd4:	89 45 ec             	mov    %eax,-0x14(%ebp)
    if((addr = a[bn]) == 0){
80101bd7:	8b 45 0c             	mov    0xc(%ebp),%eax
80101bda:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
80101be1:	8b 45 ec             	mov    -0x14(%ebp),%eax
80101be4:	01 d0                	add    %edx,%eax
80101be6:	8b 00                	mov    (%eax),%eax
80101be8:	89 45 f4             	mov    %eax,-0xc(%ebp)
80101beb:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80101bef:	75 30                	jne    80101c21 <bmap+0xeb>
      a[bn] = addr = balloc(ip->dev);
80101bf1:	8b 45 0c             	mov    0xc(%ebp),%eax
80101bf4:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
80101bfb:	8b 45 ec             	mov    -0x14(%ebp),%eax
80101bfe:	8d 1c 02             	lea    (%edx,%eax,1),%ebx
80101c01:	8b 45 08             	mov    0x8(%ebp),%eax
80101c04:	8b 00                	mov    (%eax),%eax
80101c06:	89 04 24             	mov    %eax,(%esp)
80101c09:	e8 9d f7 ff ff       	call   801013ab <balloc>
80101c0e:	89 45 f4             	mov    %eax,-0xc(%ebp)
80101c11:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101c14:	89 03                	mov    %eax,(%ebx)
      log_write(bp);
80101c16:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101c19:	89 04 24             	mov    %eax,(%esp)
80101c1c:	e8 f0 16 00 00       	call   80103311 <log_write>
    }
    brelse(bp);
80101c21:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101c24:	89 04 24             	mov    %eax,(%esp)
80101c27:	e8 eb e5 ff ff       	call   80100217 <brelse>
    return addr;
80101c2c:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101c2f:	eb 0c                	jmp    80101c3d <bmap+0x107>
  }

  panic("bmap: out of range");
80101c31:	c7 04 24 0e 88 10 80 	movl   $0x8010880e,(%esp)
80101c38:	e8 09 e9 ff ff       	call   80100546 <panic>
}
80101c3d:	83 c4 24             	add    $0x24,%esp
80101c40:	5b                   	pop    %ebx
80101c41:	5d                   	pop    %ebp
80101c42:	c3                   	ret    

80101c43 <itrunc>:
// to it (no directory entries referring to it)
// and has no in-memory reference to it (is
// not an open file or current directory).
static void
itrunc(struct inode *ip)
{
80101c43:	55                   	push   %ebp
80101c44:	89 e5                	mov    %esp,%ebp
80101c46:	83 ec 28             	sub    $0x28,%esp
  int i, j;
  struct buf *bp;
  uint *a;

  for(i = 0; i < NDIRECT; i++){
80101c49:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
80101c50:	eb 44                	jmp    80101c96 <itrunc+0x53>
    if(ip->addrs[i]){
80101c52:	8b 45 08             	mov    0x8(%ebp),%eax
80101c55:	8b 55 f4             	mov    -0xc(%ebp),%edx
80101c58:	83 c2 04             	add    $0x4,%edx
80101c5b:	8b 44 90 0c          	mov    0xc(%eax,%edx,4),%eax
80101c5f:	85 c0                	test   %eax,%eax
80101c61:	74 2f                	je     80101c92 <itrunc+0x4f>
      bfree(ip->dev, ip->addrs[i]);
80101c63:	8b 45 08             	mov    0x8(%ebp),%eax
80101c66:	8b 55 f4             	mov    -0xc(%ebp),%edx
80101c69:	83 c2 04             	add    $0x4,%edx
80101c6c:	8b 54 90 0c          	mov    0xc(%eax,%edx,4),%edx
80101c70:	8b 45 08             	mov    0x8(%ebp),%eax
80101c73:	8b 00                	mov    (%eax),%eax
80101c75:	89 54 24 04          	mov    %edx,0x4(%esp)
80101c79:	89 04 24             	mov    %eax,(%esp)
80101c7c:	e8 83 f8 ff ff       	call   80101504 <bfree>
      ip->addrs[i] = 0;
80101c81:	8b 45 08             	mov    0x8(%ebp),%eax
80101c84:	8b 55 f4             	mov    -0xc(%ebp),%edx
80101c87:	83 c2 04             	add    $0x4,%edx
80101c8a:	c7 44 90 0c 00 00 00 	movl   $0x0,0xc(%eax,%edx,4)
80101c91:	00 
{
  int i, j;
  struct buf *bp;
  uint *a;

  for(i = 0; i < NDIRECT; i++){
80101c92:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
80101c96:	83 7d f4 0b          	cmpl   $0xb,-0xc(%ebp)
80101c9a:	7e b6                	jle    80101c52 <itrunc+0xf>
      bfree(ip->dev, ip->addrs[i]);
      ip->addrs[i] = 0;
    }
  }
  
  if(ip->addrs[NDIRECT]){
80101c9c:	8b 45 08             	mov    0x8(%ebp),%eax
80101c9f:	8b 40 4c             	mov    0x4c(%eax),%eax
80101ca2:	85 c0                	test   %eax,%eax
80101ca4:	0f 84 9b 00 00 00    	je     80101d45 <itrunc+0x102>
    bp = bread(ip->dev, ip->addrs[NDIRECT]);
80101caa:	8b 45 08             	mov    0x8(%ebp),%eax
80101cad:	8b 50 4c             	mov    0x4c(%eax),%edx
80101cb0:	8b 45 08             	mov    0x8(%ebp),%eax
80101cb3:	8b 00                	mov    (%eax),%eax
80101cb5:	89 54 24 04          	mov    %edx,0x4(%esp)
80101cb9:	89 04 24             	mov    %eax,(%esp)
80101cbc:	e8 e5 e4 ff ff       	call   801001a6 <bread>
80101cc1:	89 45 ec             	mov    %eax,-0x14(%ebp)
    a = (uint*)bp->data;
80101cc4:	8b 45 ec             	mov    -0x14(%ebp),%eax
80101cc7:	83 c0 18             	add    $0x18,%eax
80101cca:	89 45 e8             	mov    %eax,-0x18(%ebp)
    for(j = 0; j < NINDIRECT; j++){
80101ccd:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
80101cd4:	eb 3b                	jmp    80101d11 <itrunc+0xce>
      if(a[j])
80101cd6:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101cd9:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
80101ce0:	8b 45 e8             	mov    -0x18(%ebp),%eax
80101ce3:	01 d0                	add    %edx,%eax
80101ce5:	8b 00                	mov    (%eax),%eax
80101ce7:	85 c0                	test   %eax,%eax
80101ce9:	74 22                	je     80101d0d <itrunc+0xca>
        bfree(ip->dev, a[j]);
80101ceb:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101cee:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
80101cf5:	8b 45 e8             	mov    -0x18(%ebp),%eax
80101cf8:	01 d0                	add    %edx,%eax
80101cfa:	8b 10                	mov    (%eax),%edx
80101cfc:	8b 45 08             	mov    0x8(%ebp),%eax
80101cff:	8b 00                	mov    (%eax),%eax
80101d01:	89 54 24 04          	mov    %edx,0x4(%esp)
80101d05:	89 04 24             	mov    %eax,(%esp)
80101d08:	e8 f7 f7 ff ff       	call   80101504 <bfree>
  }
  
  if(ip->addrs[NDIRECT]){
    bp = bread(ip->dev, ip->addrs[NDIRECT]);
    a = (uint*)bp->data;
    for(j = 0; j < NINDIRECT; j++){
80101d0d:	83 45 f0 01          	addl   $0x1,-0x10(%ebp)
80101d11:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101d14:	83 f8 7f             	cmp    $0x7f,%eax
80101d17:	76 bd                	jbe    80101cd6 <itrunc+0x93>
      if(a[j])
        bfree(ip->dev, a[j]);
    }
    brelse(bp);
80101d19:	8b 45 ec             	mov    -0x14(%ebp),%eax
80101d1c:	89 04 24             	mov    %eax,(%esp)
80101d1f:	e8 f3 e4 ff ff       	call   80100217 <brelse>
    bfree(ip->dev, ip->addrs[NDIRECT]);
80101d24:	8b 45 08             	mov    0x8(%ebp),%eax
80101d27:	8b 50 4c             	mov    0x4c(%eax),%edx
80101d2a:	8b 45 08             	mov    0x8(%ebp),%eax
80101d2d:	8b 00                	mov    (%eax),%eax
80101d2f:	89 54 24 04          	mov    %edx,0x4(%esp)
80101d33:	89 04 24             	mov    %eax,(%esp)
80101d36:	e8 c9 f7 ff ff       	call   80101504 <bfree>
    ip->addrs[NDIRECT] = 0;
80101d3b:	8b 45 08             	mov    0x8(%ebp),%eax
80101d3e:	c7 40 4c 00 00 00 00 	movl   $0x0,0x4c(%eax)
  }

  ip->size = 0;
80101d45:	8b 45 08             	mov    0x8(%ebp),%eax
80101d48:	c7 40 18 00 00 00 00 	movl   $0x0,0x18(%eax)
  iupdate(ip);
80101d4f:	8b 45 08             	mov    0x8(%ebp),%eax
80101d52:	89 04 24             	mov    %eax,(%esp)
80101d55:	e8 7e f9 ff ff       	call   801016d8 <iupdate>
}
80101d5a:	c9                   	leave  
80101d5b:	c3                   	ret    

80101d5c <stati>:

// Copy stat information from inode.
void
stati(struct inode *ip, struct stat *st)
{
80101d5c:	55                   	push   %ebp
80101d5d:	89 e5                	mov    %esp,%ebp
  st->dev = ip->dev;
80101d5f:	8b 45 08             	mov    0x8(%ebp),%eax
80101d62:	8b 00                	mov    (%eax),%eax
80101d64:	89 c2                	mov    %eax,%edx
80101d66:	8b 45 0c             	mov    0xc(%ebp),%eax
80101d69:	89 50 04             	mov    %edx,0x4(%eax)
  st->ino = ip->inum;
80101d6c:	8b 45 08             	mov    0x8(%ebp),%eax
80101d6f:	8b 50 04             	mov    0x4(%eax),%edx
80101d72:	8b 45 0c             	mov    0xc(%ebp),%eax
80101d75:	89 50 08             	mov    %edx,0x8(%eax)
  st->type = ip->type;
80101d78:	8b 45 08             	mov    0x8(%ebp),%eax
80101d7b:	0f b7 50 10          	movzwl 0x10(%eax),%edx
80101d7f:	8b 45 0c             	mov    0xc(%ebp),%eax
80101d82:	66 89 10             	mov    %dx,(%eax)
  st->nlink = ip->nlink;
80101d85:	8b 45 08             	mov    0x8(%ebp),%eax
80101d88:	0f b7 50 16          	movzwl 0x16(%eax),%edx
80101d8c:	8b 45 0c             	mov    0xc(%ebp),%eax
80101d8f:	66 89 50 0c          	mov    %dx,0xc(%eax)
  st->size = ip->size;
80101d93:	8b 45 08             	mov    0x8(%ebp),%eax
80101d96:	8b 50 18             	mov    0x18(%eax),%edx
80101d99:	8b 45 0c             	mov    0xc(%ebp),%eax
80101d9c:	89 50 10             	mov    %edx,0x10(%eax)
}
80101d9f:	5d                   	pop    %ebp
80101da0:	c3                   	ret    

80101da1 <readi>:

//PAGEBREAK!
// Read data from inode.
int
readi(struct inode *ip, char *dst, uint off, uint n)
{
80101da1:	55                   	push   %ebp
80101da2:	89 e5                	mov    %esp,%ebp
80101da4:	53                   	push   %ebx
80101da5:	83 ec 24             	sub    $0x24,%esp
  uint tot, m;
  struct buf *bp;

  if(ip->type == T_DEV){
80101da8:	8b 45 08             	mov    0x8(%ebp),%eax
80101dab:	0f b7 40 10          	movzwl 0x10(%eax),%eax
80101daf:	66 83 f8 03          	cmp    $0x3,%ax
80101db3:	75 60                	jne    80101e15 <readi+0x74>
    if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].read)
80101db5:	8b 45 08             	mov    0x8(%ebp),%eax
80101db8:	0f b7 40 12          	movzwl 0x12(%eax),%eax
80101dbc:	66 85 c0             	test   %ax,%ax
80101dbf:	78 20                	js     80101de1 <readi+0x40>
80101dc1:	8b 45 08             	mov    0x8(%ebp),%eax
80101dc4:	0f b7 40 12          	movzwl 0x12(%eax),%eax
80101dc8:	66 83 f8 09          	cmp    $0x9,%ax
80101dcc:	7f 13                	jg     80101de1 <readi+0x40>
80101dce:	8b 45 08             	mov    0x8(%ebp),%eax
80101dd1:	0f b7 40 12          	movzwl 0x12(%eax),%eax
80101dd5:	98                   	cwtl   
80101dd6:	8b 04 c5 40 e8 10 80 	mov    -0x7fef17c0(,%eax,8),%eax
80101ddd:	85 c0                	test   %eax,%eax
80101ddf:	75 0a                	jne    80101deb <readi+0x4a>
      return -1;
80101de1:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80101de6:	e9 1e 01 00 00       	jmp    80101f09 <readi+0x168>
    return devsw[ip->major].read(ip, dst, n);
80101deb:	8b 45 08             	mov    0x8(%ebp),%eax
80101dee:	0f b7 40 12          	movzwl 0x12(%eax),%eax
80101df2:	98                   	cwtl   
80101df3:	8b 04 c5 40 e8 10 80 	mov    -0x7fef17c0(,%eax,8),%eax
80101dfa:	8b 55 14             	mov    0x14(%ebp),%edx
80101dfd:	89 54 24 08          	mov    %edx,0x8(%esp)
80101e01:	8b 55 0c             	mov    0xc(%ebp),%edx
80101e04:	89 54 24 04          	mov    %edx,0x4(%esp)
80101e08:	8b 55 08             	mov    0x8(%ebp),%edx
80101e0b:	89 14 24             	mov    %edx,(%esp)
80101e0e:	ff d0                	call   *%eax
80101e10:	e9 f4 00 00 00       	jmp    80101f09 <readi+0x168>
  }

  if(off > ip->size || off + n < off)
80101e15:	8b 45 08             	mov    0x8(%ebp),%eax
80101e18:	8b 40 18             	mov    0x18(%eax),%eax
80101e1b:	3b 45 10             	cmp    0x10(%ebp),%eax
80101e1e:	72 0d                	jb     80101e2d <readi+0x8c>
80101e20:	8b 45 14             	mov    0x14(%ebp),%eax
80101e23:	8b 55 10             	mov    0x10(%ebp),%edx
80101e26:	01 d0                	add    %edx,%eax
80101e28:	3b 45 10             	cmp    0x10(%ebp),%eax
80101e2b:	73 0a                	jae    80101e37 <readi+0x96>
    return -1;
80101e2d:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80101e32:	e9 d2 00 00 00       	jmp    80101f09 <readi+0x168>
  if(off + n > ip->size)
80101e37:	8b 45 14             	mov    0x14(%ebp),%eax
80101e3a:	8b 55 10             	mov    0x10(%ebp),%edx
80101e3d:	01 c2                	add    %eax,%edx
80101e3f:	8b 45 08             	mov    0x8(%ebp),%eax
80101e42:	8b 40 18             	mov    0x18(%eax),%eax
80101e45:	39 c2                	cmp    %eax,%edx
80101e47:	76 0c                	jbe    80101e55 <readi+0xb4>
    n = ip->size - off;
80101e49:	8b 45 08             	mov    0x8(%ebp),%eax
80101e4c:	8b 40 18             	mov    0x18(%eax),%eax
80101e4f:	2b 45 10             	sub    0x10(%ebp),%eax
80101e52:	89 45 14             	mov    %eax,0x14(%ebp)

  for(tot=0; tot<n; tot+=m, off+=m, dst+=m){
80101e55:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
80101e5c:	e9 99 00 00 00       	jmp    80101efa <readi+0x159>
    bp = bread(ip->dev, bmap(ip, off/BSIZE));
80101e61:	8b 45 10             	mov    0x10(%ebp),%eax
80101e64:	c1 e8 09             	shr    $0x9,%eax
80101e67:	89 44 24 04          	mov    %eax,0x4(%esp)
80101e6b:	8b 45 08             	mov    0x8(%ebp),%eax
80101e6e:	89 04 24             	mov    %eax,(%esp)
80101e71:	e8 c0 fc ff ff       	call   80101b36 <bmap>
80101e76:	8b 55 08             	mov    0x8(%ebp),%edx
80101e79:	8b 12                	mov    (%edx),%edx
80101e7b:	89 44 24 04          	mov    %eax,0x4(%esp)
80101e7f:	89 14 24             	mov    %edx,(%esp)
80101e82:	e8 1f e3 ff ff       	call   801001a6 <bread>
80101e87:	89 45 f0             	mov    %eax,-0x10(%ebp)
    m = min(n - tot, BSIZE - off%BSIZE);
80101e8a:	8b 45 10             	mov    0x10(%ebp),%eax
80101e8d:	89 c2                	mov    %eax,%edx
80101e8f:	81 e2 ff 01 00 00    	and    $0x1ff,%edx
80101e95:	b8 00 02 00 00       	mov    $0x200,%eax
80101e9a:	89 c1                	mov    %eax,%ecx
80101e9c:	29 d1                	sub    %edx,%ecx
80101e9e:	89 ca                	mov    %ecx,%edx
80101ea0:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101ea3:	8b 4d 14             	mov    0x14(%ebp),%ecx
80101ea6:	89 cb                	mov    %ecx,%ebx
80101ea8:	29 c3                	sub    %eax,%ebx
80101eaa:	89 d8                	mov    %ebx,%eax
80101eac:	39 c2                	cmp    %eax,%edx
80101eae:	0f 46 c2             	cmovbe %edx,%eax
80101eb1:	89 45 ec             	mov    %eax,-0x14(%ebp)
    memmove(dst, bp->data + off%BSIZE, m);
80101eb4:	8b 45 10             	mov    0x10(%ebp),%eax
80101eb7:	25 ff 01 00 00       	and    $0x1ff,%eax
80101ebc:	8d 50 10             	lea    0x10(%eax),%edx
80101ebf:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101ec2:	01 d0                	add    %edx,%eax
80101ec4:	8d 50 08             	lea    0x8(%eax),%edx
80101ec7:	8b 45 ec             	mov    -0x14(%ebp),%eax
80101eca:	89 44 24 08          	mov    %eax,0x8(%esp)
80101ece:	89 54 24 04          	mov    %edx,0x4(%esp)
80101ed2:	8b 45 0c             	mov    0xc(%ebp),%eax
80101ed5:	89 04 24             	mov    %eax,(%esp)
80101ed8:	e8 68 34 00 00       	call   80105345 <memmove>
    brelse(bp);
80101edd:	8b 45 f0             	mov    -0x10(%ebp),%eax
80101ee0:	89 04 24             	mov    %eax,(%esp)
80101ee3:	e8 2f e3 ff ff       	call   80100217 <brelse>
  if(off > ip->size || off + n < off)
    return -1;
  if(off + n > ip->size)
    n = ip->size - off;

  for(tot=0; tot<n; tot+=m, off+=m, dst+=m){
80101ee8:	8b 45 ec             	mov    -0x14(%ebp),%eax
80101eeb:	01 45 f4             	add    %eax,-0xc(%ebp)
80101eee:	8b 45 ec             	mov    -0x14(%ebp),%eax
80101ef1:	01 45 10             	add    %eax,0x10(%ebp)
80101ef4:	8b 45 ec             	mov    -0x14(%ebp),%eax
80101ef7:	01 45 0c             	add    %eax,0xc(%ebp)
80101efa:	8b 45 f4             	mov    -0xc(%ebp),%eax
80101efd:	3b 45 14             	cmp    0x14(%ebp),%eax
80101f00:	0f 82 5b ff ff ff    	jb     80101e61 <readi+0xc0>
    bp = bread(ip->dev, bmap(ip, off/BSIZE));
    m = min(n - tot, BSIZE - off%BSIZE);
    memmove(dst, bp->data + off%BSIZE, m);
    brelse(bp);
  }
  return n;
80101f06:	8b 45 14             	mov    0x14(%ebp),%eax
}
80101f09:	83 c4 24             	add    $0x24,%esp
80101f0c:	5b                   	pop    %ebx
80101f0d:	5d                   	pop    %ebp
80101f0e:	c3                   	ret    

80101f0f <writei>:

// PAGEBREAK!
// Write data to inode.
int
writei(struct inode *ip, char *src, uint off, uint n)
{
80101f0f:	55                   	push   %ebp
80101f10:	89 e5                	mov    %esp,%ebp
80101f12:	53                   	push   %ebx
80101f13:	83 ec 24             	sub    $0x24,%esp
  uint tot, m;
  struct buf *bp;

  if(ip->type == T_DEV){
80101f16:	8b 45 08             	mov    0x8(%ebp),%eax
80101f19:	0f b7 40 10          	movzwl 0x10(%eax),%eax
80101f1d:	66 83 f8 03          	cmp    $0x3,%ax
80101f21:	75 60                	jne    80101f83 <writei+0x74>
    if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].write)
80101f23:	8b 45 08             	mov    0x8(%ebp),%eax
80101f26:	0f b7 40 12          	movzwl 0x12(%eax),%eax
80101f2a:	66 85 c0             	test   %ax,%ax
80101f2d:	78 20                	js     80101f4f <writei+0x40>
80101f2f:	8b 45 08             	mov    0x8(%ebp),%eax
80101f32:	0f b7 40 12          	movzwl 0x12(%eax),%eax
80101f36:	66 83 f8 09          	cmp    $0x9,%ax
80101f3a:	7f 13                	jg     80101f4f <writei+0x40>
80101f3c:	8b 45 08             	mov    0x8(%ebp),%eax
80101f3f:	0f b7 40 12          	movzwl 0x12(%eax),%eax
80101f43:	98                   	cwtl   
80101f44:	8b 04 c5 44 e8 10 80 	mov    -0x7fef17bc(,%eax,8),%eax
80101f4b:	85 c0                	test   %eax,%eax
80101f4d:	75 0a                	jne    80101f59 <writei+0x4a>
      return -1;
80101f4f:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80101f54:	e9 49 01 00 00       	jmp    801020a2 <writei+0x193>
    return devsw[ip->major].write(ip, src, n);
80101f59:	8b 45 08             	mov    0x8(%ebp),%eax
80101f5c:	0f b7 40 12          	movzwl 0x12(%eax),%eax
80101f60:	98                   	cwtl   
80101f61:	8b 04 c5 44 e8 10 80 	mov    -0x7fef17bc(,%eax,8),%eax
80101f68:	8b 55 14             	mov    0x14(%ebp),%edx
80101f6b:	89 54 24 08          	mov    %edx,0x8(%esp)
80101f6f:	8b 55 0c             	mov    0xc(%ebp),%edx
80101f72:	89 54 24 04          	mov    %edx,0x4(%esp)
80101f76:	8b 55 08             	mov    0x8(%ebp),%edx
80101f79:	89 14 24             	mov    %edx,(%esp)
80101f7c:	ff d0                	call   *%eax
80101f7e:	e9 1f 01 00 00       	jmp    801020a2 <writei+0x193>
  }

  if(off > ip->size || off + n < off)
80101f83:	8b 45 08             	mov    0x8(%ebp),%eax
80101f86:	8b 40 18             	mov    0x18(%eax),%eax
80101f89:	3b 45 10             	cmp    0x10(%ebp),%eax
80101f8c:	72 0d                	jb     80101f9b <writei+0x8c>
80101f8e:	8b 45 14             	mov    0x14(%ebp),%eax
80101f91:	8b 55 10             	mov    0x10(%ebp),%edx
80101f94:	01 d0                	add    %edx,%eax
80101f96:	3b 45 10             	cmp    0x10(%ebp),%eax
80101f99:	73 0a                	jae    80101fa5 <writei+0x96>
    return -1;
80101f9b:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80101fa0:	e9 fd 00 00 00       	jmp    801020a2 <writei+0x193>
  if(off + n > MAXFILE*BSIZE)
80101fa5:	8b 45 14             	mov    0x14(%ebp),%eax
80101fa8:	8b 55 10             	mov    0x10(%ebp),%edx
80101fab:	01 d0                	add    %edx,%eax
80101fad:	3d 00 18 01 00       	cmp    $0x11800,%eax
80101fb2:	76 0a                	jbe    80101fbe <writei+0xaf>
    return -1;
80101fb4:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80101fb9:	e9 e4 00 00 00       	jmp    801020a2 <writei+0x193>

  for(tot=0; tot<n; tot+=m, off+=m, src+=m){
80101fbe:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
80101fc5:	e9 a4 00 00 00       	jmp    8010206e <writei+0x15f>
    bp = bread(ip->dev, bmap(ip, off/BSIZE));
80101fca:	8b 45 10             	mov    0x10(%ebp),%eax
80101fcd:	c1 e8 09             	shr    $0x9,%eax
80101fd0:	89 44 24 04          	mov    %eax,0x4(%esp)
80101fd4:	8b 45 08             	mov    0x8(%ebp),%eax
80101fd7:	89 04 24             	mov    %eax,(%esp)
80101fda:	e8 57 fb ff ff       	call   80101b36 <bmap>
80101fdf:	8b 55 08             	mov    0x8(%ebp),%edx
80101fe2:	8b 12                	mov    (%edx),%edx
80101fe4:	89 44 24 04          	mov    %eax,0x4(%esp)
80101fe8:	89 14 24             	mov    %edx,(%esp)
80101feb:	e8 b6 e1 ff ff       	call   801001a6 <bread>
80101ff0:	89 45 f0             	mov    %eax,-0x10(%ebp)
    m = min(n - tot, BSIZE - off%BSIZE);
80101ff3:	8b 45 10             	mov    0x10(%ebp),%eax
80101ff6:	89 c2                	mov    %eax,%edx
80101ff8:	81 e2 ff 01 00 00    	and    $0x1ff,%edx
80101ffe:	b8 00 02 00 00       	mov    $0x200,%eax
80102003:	89 c1                	mov    %eax,%ecx
80102005:	29 d1                	sub    %edx,%ecx
80102007:	89 ca                	mov    %ecx,%edx
80102009:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010200c:	8b 4d 14             	mov    0x14(%ebp),%ecx
8010200f:	89 cb                	mov    %ecx,%ebx
80102011:	29 c3                	sub    %eax,%ebx
80102013:	89 d8                	mov    %ebx,%eax
80102015:	39 c2                	cmp    %eax,%edx
80102017:	0f 46 c2             	cmovbe %edx,%eax
8010201a:	89 45 ec             	mov    %eax,-0x14(%ebp)
    memmove(bp->data + off%BSIZE, src, m);
8010201d:	8b 45 10             	mov    0x10(%ebp),%eax
80102020:	25 ff 01 00 00       	and    $0x1ff,%eax
80102025:	8d 50 10             	lea    0x10(%eax),%edx
80102028:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010202b:	01 d0                	add    %edx,%eax
8010202d:	8d 50 08             	lea    0x8(%eax),%edx
80102030:	8b 45 ec             	mov    -0x14(%ebp),%eax
80102033:	89 44 24 08          	mov    %eax,0x8(%esp)
80102037:	8b 45 0c             	mov    0xc(%ebp),%eax
8010203a:	89 44 24 04          	mov    %eax,0x4(%esp)
8010203e:	89 14 24             	mov    %edx,(%esp)
80102041:	e8 ff 32 00 00       	call   80105345 <memmove>
    log_write(bp);
80102046:	8b 45 f0             	mov    -0x10(%ebp),%eax
80102049:	89 04 24             	mov    %eax,(%esp)
8010204c:	e8 c0 12 00 00       	call   80103311 <log_write>
    brelse(bp);
80102051:	8b 45 f0             	mov    -0x10(%ebp),%eax
80102054:	89 04 24             	mov    %eax,(%esp)
80102057:	e8 bb e1 ff ff       	call   80100217 <brelse>
  if(off > ip->size || off + n < off)
    return -1;
  if(off + n > MAXFILE*BSIZE)
    return -1;

  for(tot=0; tot<n; tot+=m, off+=m, src+=m){
8010205c:	8b 45 ec             	mov    -0x14(%ebp),%eax
8010205f:	01 45 f4             	add    %eax,-0xc(%ebp)
80102062:	8b 45 ec             	mov    -0x14(%ebp),%eax
80102065:	01 45 10             	add    %eax,0x10(%ebp)
80102068:	8b 45 ec             	mov    -0x14(%ebp),%eax
8010206b:	01 45 0c             	add    %eax,0xc(%ebp)
8010206e:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102071:	3b 45 14             	cmp    0x14(%ebp),%eax
80102074:	0f 82 50 ff ff ff    	jb     80101fca <writei+0xbb>
    memmove(bp->data + off%BSIZE, src, m);
    log_write(bp);
    brelse(bp);
  }

  if(n > 0 && off > ip->size){
8010207a:	83 7d 14 00          	cmpl   $0x0,0x14(%ebp)
8010207e:	74 1f                	je     8010209f <writei+0x190>
80102080:	8b 45 08             	mov    0x8(%ebp),%eax
80102083:	8b 40 18             	mov    0x18(%eax),%eax
80102086:	3b 45 10             	cmp    0x10(%ebp),%eax
80102089:	73 14                	jae    8010209f <writei+0x190>
    ip->size = off;
8010208b:	8b 45 08             	mov    0x8(%ebp),%eax
8010208e:	8b 55 10             	mov    0x10(%ebp),%edx
80102091:	89 50 18             	mov    %edx,0x18(%eax)
    iupdate(ip);
80102094:	8b 45 08             	mov    0x8(%ebp),%eax
80102097:	89 04 24             	mov    %eax,(%esp)
8010209a:	e8 39 f6 ff ff       	call   801016d8 <iupdate>
  }
  return n;
8010209f:	8b 45 14             	mov    0x14(%ebp),%eax
}
801020a2:	83 c4 24             	add    $0x24,%esp
801020a5:	5b                   	pop    %ebx
801020a6:	5d                   	pop    %ebp
801020a7:	c3                   	ret    

801020a8 <namecmp>:
//PAGEBREAK!
// Directories

int
namecmp(const char *s, const char *t)
{
801020a8:	55                   	push   %ebp
801020a9:	89 e5                	mov    %esp,%ebp
801020ab:	83 ec 18             	sub    $0x18,%esp
  return strncmp(s, t, DIRSIZ);
801020ae:	c7 44 24 08 0e 00 00 	movl   $0xe,0x8(%esp)
801020b5:	00 
801020b6:	8b 45 0c             	mov    0xc(%ebp),%eax
801020b9:	89 44 24 04          	mov    %eax,0x4(%esp)
801020bd:	8b 45 08             	mov    0x8(%ebp),%eax
801020c0:	89 04 24             	mov    %eax,(%esp)
801020c3:	e8 21 33 00 00       	call   801053e9 <strncmp>
}
801020c8:	c9                   	leave  
801020c9:	c3                   	ret    

801020ca <dirlookup>:

// Look for a directory entry in a directory.
// If found, set *poff to byte offset of entry.
struct inode*
dirlookup(struct inode *dp, char *name, uint *poff)
{
801020ca:	55                   	push   %ebp
801020cb:	89 e5                	mov    %esp,%ebp
801020cd:	83 ec 38             	sub    $0x38,%esp
  uint off, inum;
  struct dirent de;

  if(dp->type != T_DIR)
801020d0:	8b 45 08             	mov    0x8(%ebp),%eax
801020d3:	0f b7 40 10          	movzwl 0x10(%eax),%eax
801020d7:	66 83 f8 01          	cmp    $0x1,%ax
801020db:	74 0c                	je     801020e9 <dirlookup+0x1f>
    panic("dirlookup not DIR");
801020dd:	c7 04 24 21 88 10 80 	movl   $0x80108821,(%esp)
801020e4:	e8 5d e4 ff ff       	call   80100546 <panic>

  for(off = 0; off < dp->size; off += sizeof(de)){
801020e9:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
801020f0:	e9 87 00 00 00       	jmp    8010217c <dirlookup+0xb2>
    if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
801020f5:	c7 44 24 0c 10 00 00 	movl   $0x10,0xc(%esp)
801020fc:	00 
801020fd:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102100:	89 44 24 08          	mov    %eax,0x8(%esp)
80102104:	8d 45 e0             	lea    -0x20(%ebp),%eax
80102107:	89 44 24 04          	mov    %eax,0x4(%esp)
8010210b:	8b 45 08             	mov    0x8(%ebp),%eax
8010210e:	89 04 24             	mov    %eax,(%esp)
80102111:	e8 8b fc ff ff       	call   80101da1 <readi>
80102116:	83 f8 10             	cmp    $0x10,%eax
80102119:	74 0c                	je     80102127 <dirlookup+0x5d>
      panic("dirlink read");
8010211b:	c7 04 24 33 88 10 80 	movl   $0x80108833,(%esp)
80102122:	e8 1f e4 ff ff       	call   80100546 <panic>
    if(de.inum == 0)
80102127:	0f b7 45 e0          	movzwl -0x20(%ebp),%eax
8010212b:	66 85 c0             	test   %ax,%ax
8010212e:	74 47                	je     80102177 <dirlookup+0xad>
      continue;
    if(namecmp(name, de.name) == 0){
80102130:	8d 45 e0             	lea    -0x20(%ebp),%eax
80102133:	83 c0 02             	add    $0x2,%eax
80102136:	89 44 24 04          	mov    %eax,0x4(%esp)
8010213a:	8b 45 0c             	mov    0xc(%ebp),%eax
8010213d:	89 04 24             	mov    %eax,(%esp)
80102140:	e8 63 ff ff ff       	call   801020a8 <namecmp>
80102145:	85 c0                	test   %eax,%eax
80102147:	75 2f                	jne    80102178 <dirlookup+0xae>
      // entry matches path element
      if(poff)
80102149:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
8010214d:	74 08                	je     80102157 <dirlookup+0x8d>
        *poff = off;
8010214f:	8b 45 10             	mov    0x10(%ebp),%eax
80102152:	8b 55 f4             	mov    -0xc(%ebp),%edx
80102155:	89 10                	mov    %edx,(%eax)
      inum = de.inum;
80102157:	0f b7 45 e0          	movzwl -0x20(%ebp),%eax
8010215b:	0f b7 c0             	movzwl %ax,%eax
8010215e:	89 45 f0             	mov    %eax,-0x10(%ebp)
      return iget(dp->dev, inum);
80102161:	8b 45 08             	mov    0x8(%ebp),%eax
80102164:	8b 00                	mov    (%eax),%eax
80102166:	8b 55 f0             	mov    -0x10(%ebp),%edx
80102169:	89 54 24 04          	mov    %edx,0x4(%esp)
8010216d:	89 04 24             	mov    %eax,(%esp)
80102170:	e8 1b f6 ff ff       	call   80101790 <iget>
80102175:	eb 19                	jmp    80102190 <dirlookup+0xc6>

  for(off = 0; off < dp->size; off += sizeof(de)){
    if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
      panic("dirlink read");
    if(de.inum == 0)
      continue;
80102177:	90                   	nop
  struct dirent de;

  if(dp->type != T_DIR)
    panic("dirlookup not DIR");

  for(off = 0; off < dp->size; off += sizeof(de)){
80102178:	83 45 f4 10          	addl   $0x10,-0xc(%ebp)
8010217c:	8b 45 08             	mov    0x8(%ebp),%eax
8010217f:	8b 40 18             	mov    0x18(%eax),%eax
80102182:	3b 45 f4             	cmp    -0xc(%ebp),%eax
80102185:	0f 87 6a ff ff ff    	ja     801020f5 <dirlookup+0x2b>
      inum = de.inum;
      return iget(dp->dev, inum);
    }
  }

  return 0;
8010218b:	b8 00 00 00 00       	mov    $0x0,%eax
}
80102190:	c9                   	leave  
80102191:	c3                   	ret    

80102192 <dirlink>:

// Write a new directory entry (name, inum) into the directory dp.
int
dirlink(struct inode *dp, char *name, uint inum)
{
80102192:	55                   	push   %ebp
80102193:	89 e5                	mov    %esp,%ebp
80102195:	83 ec 38             	sub    $0x38,%esp
  int off;
  struct dirent de;
  struct inode *ip;

  // Check that name is not present.
  if((ip = dirlookup(dp, name, 0)) != 0){
80102198:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
8010219f:	00 
801021a0:	8b 45 0c             	mov    0xc(%ebp),%eax
801021a3:	89 44 24 04          	mov    %eax,0x4(%esp)
801021a7:	8b 45 08             	mov    0x8(%ebp),%eax
801021aa:	89 04 24             	mov    %eax,(%esp)
801021ad:	e8 18 ff ff ff       	call   801020ca <dirlookup>
801021b2:	89 45 f0             	mov    %eax,-0x10(%ebp)
801021b5:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
801021b9:	74 15                	je     801021d0 <dirlink+0x3e>
    iput(ip);
801021bb:	8b 45 f0             	mov    -0x10(%ebp),%eax
801021be:	89 04 24             	mov    %eax,(%esp)
801021c1:	e8 81 f8 ff ff       	call   80101a47 <iput>
    return -1;
801021c6:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
801021cb:	e9 b8 00 00 00       	jmp    80102288 <dirlink+0xf6>
  }

  // Look for an empty dirent.
  for(off = 0; off < dp->size; off += sizeof(de)){
801021d0:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
801021d7:	eb 44                	jmp    8010221d <dirlink+0x8b>
    if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
801021d9:	8b 45 f4             	mov    -0xc(%ebp),%eax
801021dc:	c7 44 24 0c 10 00 00 	movl   $0x10,0xc(%esp)
801021e3:	00 
801021e4:	89 44 24 08          	mov    %eax,0x8(%esp)
801021e8:	8d 45 e0             	lea    -0x20(%ebp),%eax
801021eb:	89 44 24 04          	mov    %eax,0x4(%esp)
801021ef:	8b 45 08             	mov    0x8(%ebp),%eax
801021f2:	89 04 24             	mov    %eax,(%esp)
801021f5:	e8 a7 fb ff ff       	call   80101da1 <readi>
801021fa:	83 f8 10             	cmp    $0x10,%eax
801021fd:	74 0c                	je     8010220b <dirlink+0x79>
      panic("dirlink read");
801021ff:	c7 04 24 33 88 10 80 	movl   $0x80108833,(%esp)
80102206:	e8 3b e3 ff ff       	call   80100546 <panic>
    if(de.inum == 0)
8010220b:	0f b7 45 e0          	movzwl -0x20(%ebp),%eax
8010220f:	66 85 c0             	test   %ax,%ax
80102212:	74 18                	je     8010222c <dirlink+0x9a>
    iput(ip);
    return -1;
  }

  // Look for an empty dirent.
  for(off = 0; off < dp->size; off += sizeof(de)){
80102214:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102217:	83 c0 10             	add    $0x10,%eax
8010221a:	89 45 f4             	mov    %eax,-0xc(%ebp)
8010221d:	8b 55 f4             	mov    -0xc(%ebp),%edx
80102220:	8b 45 08             	mov    0x8(%ebp),%eax
80102223:	8b 40 18             	mov    0x18(%eax),%eax
80102226:	39 c2                	cmp    %eax,%edx
80102228:	72 af                	jb     801021d9 <dirlink+0x47>
8010222a:	eb 01                	jmp    8010222d <dirlink+0x9b>
    if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
      panic("dirlink read");
    if(de.inum == 0)
      break;
8010222c:	90                   	nop
  }

  strncpy(de.name, name, DIRSIZ);
8010222d:	c7 44 24 08 0e 00 00 	movl   $0xe,0x8(%esp)
80102234:	00 
80102235:	8b 45 0c             	mov    0xc(%ebp),%eax
80102238:	89 44 24 04          	mov    %eax,0x4(%esp)
8010223c:	8d 45 e0             	lea    -0x20(%ebp),%eax
8010223f:	83 c0 02             	add    $0x2,%eax
80102242:	89 04 24             	mov    %eax,(%esp)
80102245:	e8 f7 31 00 00       	call   80105441 <strncpy>
  de.inum = inum;
8010224a:	8b 45 10             	mov    0x10(%ebp),%eax
8010224d:	66 89 45 e0          	mov    %ax,-0x20(%ebp)
  if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
80102251:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102254:	c7 44 24 0c 10 00 00 	movl   $0x10,0xc(%esp)
8010225b:	00 
8010225c:	89 44 24 08          	mov    %eax,0x8(%esp)
80102260:	8d 45 e0             	lea    -0x20(%ebp),%eax
80102263:	89 44 24 04          	mov    %eax,0x4(%esp)
80102267:	8b 45 08             	mov    0x8(%ebp),%eax
8010226a:	89 04 24             	mov    %eax,(%esp)
8010226d:	e8 9d fc ff ff       	call   80101f0f <writei>
80102272:	83 f8 10             	cmp    $0x10,%eax
80102275:	74 0c                	je     80102283 <dirlink+0xf1>
    panic("dirlink");
80102277:	c7 04 24 40 88 10 80 	movl   $0x80108840,(%esp)
8010227e:	e8 c3 e2 ff ff       	call   80100546 <panic>
  
  return 0;
80102283:	b8 00 00 00 00       	mov    $0x0,%eax
}
80102288:	c9                   	leave  
80102289:	c3                   	ret    

8010228a <skipelem>:
//   skipelem("a", name) = "", setting name = "a"
//   skipelem("", name) = skipelem("////", name) = 0
//
static char*
skipelem(char *path, char *name)
{
8010228a:	55                   	push   %ebp
8010228b:	89 e5                	mov    %esp,%ebp
8010228d:	83 ec 28             	sub    $0x28,%esp
  char *s;
  int len;

  while(*path == '/')
80102290:	eb 04                	jmp    80102296 <skipelem+0xc>
    path++;
80102292:	83 45 08 01          	addl   $0x1,0x8(%ebp)
skipelem(char *path, char *name)
{
  char *s;
  int len;

  while(*path == '/')
80102296:	8b 45 08             	mov    0x8(%ebp),%eax
80102299:	0f b6 00             	movzbl (%eax),%eax
8010229c:	3c 2f                	cmp    $0x2f,%al
8010229e:	74 f2                	je     80102292 <skipelem+0x8>
    path++;
  if(*path == 0)
801022a0:	8b 45 08             	mov    0x8(%ebp),%eax
801022a3:	0f b6 00             	movzbl (%eax),%eax
801022a6:	84 c0                	test   %al,%al
801022a8:	75 0a                	jne    801022b4 <skipelem+0x2a>
    return 0;
801022aa:	b8 00 00 00 00       	mov    $0x0,%eax
801022af:	e9 88 00 00 00       	jmp    8010233c <skipelem+0xb2>
  s = path;
801022b4:	8b 45 08             	mov    0x8(%ebp),%eax
801022b7:	89 45 f4             	mov    %eax,-0xc(%ebp)
  while(*path != '/' && *path != 0)
801022ba:	eb 04                	jmp    801022c0 <skipelem+0x36>
    path++;
801022bc:	83 45 08 01          	addl   $0x1,0x8(%ebp)
  while(*path == '/')
    path++;
  if(*path == 0)
    return 0;
  s = path;
  while(*path != '/' && *path != 0)
801022c0:	8b 45 08             	mov    0x8(%ebp),%eax
801022c3:	0f b6 00             	movzbl (%eax),%eax
801022c6:	3c 2f                	cmp    $0x2f,%al
801022c8:	74 0a                	je     801022d4 <skipelem+0x4a>
801022ca:	8b 45 08             	mov    0x8(%ebp),%eax
801022cd:	0f b6 00             	movzbl (%eax),%eax
801022d0:	84 c0                	test   %al,%al
801022d2:	75 e8                	jne    801022bc <skipelem+0x32>
    path++;
  len = path - s;
801022d4:	8b 55 08             	mov    0x8(%ebp),%edx
801022d7:	8b 45 f4             	mov    -0xc(%ebp),%eax
801022da:	89 d1                	mov    %edx,%ecx
801022dc:	29 c1                	sub    %eax,%ecx
801022de:	89 c8                	mov    %ecx,%eax
801022e0:	89 45 f0             	mov    %eax,-0x10(%ebp)
  if(len >= DIRSIZ)
801022e3:	83 7d f0 0d          	cmpl   $0xd,-0x10(%ebp)
801022e7:	7e 1c                	jle    80102305 <skipelem+0x7b>
    memmove(name, s, DIRSIZ);
801022e9:	c7 44 24 08 0e 00 00 	movl   $0xe,0x8(%esp)
801022f0:	00 
801022f1:	8b 45 f4             	mov    -0xc(%ebp),%eax
801022f4:	89 44 24 04          	mov    %eax,0x4(%esp)
801022f8:	8b 45 0c             	mov    0xc(%ebp),%eax
801022fb:	89 04 24             	mov    %eax,(%esp)
801022fe:	e8 42 30 00 00       	call   80105345 <memmove>
  else {
    memmove(name, s, len);
    name[len] = 0;
  }
  while(*path == '/')
80102303:	eb 2a                	jmp    8010232f <skipelem+0xa5>
    path++;
  len = path - s;
  if(len >= DIRSIZ)
    memmove(name, s, DIRSIZ);
  else {
    memmove(name, s, len);
80102305:	8b 45 f0             	mov    -0x10(%ebp),%eax
80102308:	89 44 24 08          	mov    %eax,0x8(%esp)
8010230c:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010230f:	89 44 24 04          	mov    %eax,0x4(%esp)
80102313:	8b 45 0c             	mov    0xc(%ebp),%eax
80102316:	89 04 24             	mov    %eax,(%esp)
80102319:	e8 27 30 00 00       	call   80105345 <memmove>
    name[len] = 0;
8010231e:	8b 55 f0             	mov    -0x10(%ebp),%edx
80102321:	8b 45 0c             	mov    0xc(%ebp),%eax
80102324:	01 d0                	add    %edx,%eax
80102326:	c6 00 00             	movb   $0x0,(%eax)
  }
  while(*path == '/')
80102329:	eb 04                	jmp    8010232f <skipelem+0xa5>
    path++;
8010232b:	83 45 08 01          	addl   $0x1,0x8(%ebp)
    memmove(name, s, DIRSIZ);
  else {
    memmove(name, s, len);
    name[len] = 0;
  }
  while(*path == '/')
8010232f:	8b 45 08             	mov    0x8(%ebp),%eax
80102332:	0f b6 00             	movzbl (%eax),%eax
80102335:	3c 2f                	cmp    $0x2f,%al
80102337:	74 f2                	je     8010232b <skipelem+0xa1>
    path++;
  return path;
80102339:	8b 45 08             	mov    0x8(%ebp),%eax
}
8010233c:	c9                   	leave  
8010233d:	c3                   	ret    

8010233e <namex>:
// Look up and return the inode for a path name.
// If parent != 0, return the inode for the parent and copy the final
// path element into name, which must have room for DIRSIZ bytes.
static struct inode*
namex(char *path, int nameiparent, char *name)
{
8010233e:	55                   	push   %ebp
8010233f:	89 e5                	mov    %esp,%ebp
80102341:	83 ec 28             	sub    $0x28,%esp
  struct inode *ip, *next;

  if(*path == '/')
80102344:	8b 45 08             	mov    0x8(%ebp),%eax
80102347:	0f b6 00             	movzbl (%eax),%eax
8010234a:	3c 2f                	cmp    $0x2f,%al
8010234c:	75 1c                	jne    8010236a <namex+0x2c>
    ip = iget(ROOTDEV, ROOTINO);
8010234e:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
80102355:	00 
80102356:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
8010235d:	e8 2e f4 ff ff       	call   80101790 <iget>
80102362:	89 45 f4             	mov    %eax,-0xc(%ebp)
  else
    ip = idup(proc->cwd);

  while((path = skipelem(path, name)) != 0){
80102365:	e9 af 00 00 00       	jmp    80102419 <namex+0xdb>
  struct inode *ip, *next;

  if(*path == '/')
    ip = iget(ROOTDEV, ROOTINO);
  else
    ip = idup(proc->cwd);
8010236a:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80102370:	8b 40 68             	mov    0x68(%eax),%eax
80102373:	89 04 24             	mov    %eax,(%esp)
80102376:	e8 e7 f4 ff ff       	call   80101862 <idup>
8010237b:	89 45 f4             	mov    %eax,-0xc(%ebp)

  while((path = skipelem(path, name)) != 0){
8010237e:	e9 96 00 00 00       	jmp    80102419 <namex+0xdb>
    ilock(ip);
80102383:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102386:	89 04 24             	mov    %eax,(%esp)
80102389:	e8 06 f5 ff ff       	call   80101894 <ilock>
    if(ip->type != T_DIR){
8010238e:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102391:	0f b7 40 10          	movzwl 0x10(%eax),%eax
80102395:	66 83 f8 01          	cmp    $0x1,%ax
80102399:	74 15                	je     801023b0 <namex+0x72>
      iunlockput(ip);
8010239b:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010239e:	89 04 24             	mov    %eax,(%esp)
801023a1:	e8 72 f7 ff ff       	call   80101b18 <iunlockput>
      return 0;
801023a6:	b8 00 00 00 00       	mov    $0x0,%eax
801023ab:	e9 a3 00 00 00       	jmp    80102453 <namex+0x115>
    }
    if(nameiparent && *path == '\0'){
801023b0:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
801023b4:	74 1d                	je     801023d3 <namex+0x95>
801023b6:	8b 45 08             	mov    0x8(%ebp),%eax
801023b9:	0f b6 00             	movzbl (%eax),%eax
801023bc:	84 c0                	test   %al,%al
801023be:	75 13                	jne    801023d3 <namex+0x95>
      // Stop one level early.
      iunlock(ip);
801023c0:	8b 45 f4             	mov    -0xc(%ebp),%eax
801023c3:	89 04 24             	mov    %eax,(%esp)
801023c6:	e8 17 f6 ff ff       	call   801019e2 <iunlock>
      return ip;
801023cb:	8b 45 f4             	mov    -0xc(%ebp),%eax
801023ce:	e9 80 00 00 00       	jmp    80102453 <namex+0x115>
    }
    if((next = dirlookup(ip, name, 0)) == 0){
801023d3:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
801023da:	00 
801023db:	8b 45 10             	mov    0x10(%ebp),%eax
801023de:	89 44 24 04          	mov    %eax,0x4(%esp)
801023e2:	8b 45 f4             	mov    -0xc(%ebp),%eax
801023e5:	89 04 24             	mov    %eax,(%esp)
801023e8:	e8 dd fc ff ff       	call   801020ca <dirlookup>
801023ed:	89 45 f0             	mov    %eax,-0x10(%ebp)
801023f0:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
801023f4:	75 12                	jne    80102408 <namex+0xca>
      iunlockput(ip);
801023f6:	8b 45 f4             	mov    -0xc(%ebp),%eax
801023f9:	89 04 24             	mov    %eax,(%esp)
801023fc:	e8 17 f7 ff ff       	call   80101b18 <iunlockput>
      return 0;
80102401:	b8 00 00 00 00       	mov    $0x0,%eax
80102406:	eb 4b                	jmp    80102453 <namex+0x115>
    }
    iunlockput(ip);
80102408:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010240b:	89 04 24             	mov    %eax,(%esp)
8010240e:	e8 05 f7 ff ff       	call   80101b18 <iunlockput>
    ip = next;
80102413:	8b 45 f0             	mov    -0x10(%ebp),%eax
80102416:	89 45 f4             	mov    %eax,-0xc(%ebp)
  if(*path == '/')
    ip = iget(ROOTDEV, ROOTINO);
  else
    ip = idup(proc->cwd);

  while((path = skipelem(path, name)) != 0){
80102419:	8b 45 10             	mov    0x10(%ebp),%eax
8010241c:	89 44 24 04          	mov    %eax,0x4(%esp)
80102420:	8b 45 08             	mov    0x8(%ebp),%eax
80102423:	89 04 24             	mov    %eax,(%esp)
80102426:	e8 5f fe ff ff       	call   8010228a <skipelem>
8010242b:	89 45 08             	mov    %eax,0x8(%ebp)
8010242e:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
80102432:	0f 85 4b ff ff ff    	jne    80102383 <namex+0x45>
      return 0;
    }
    iunlockput(ip);
    ip = next;
  }
  if(nameiparent){
80102438:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
8010243c:	74 12                	je     80102450 <namex+0x112>
    iput(ip);
8010243e:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102441:	89 04 24             	mov    %eax,(%esp)
80102444:	e8 fe f5 ff ff       	call   80101a47 <iput>
    return 0;
80102449:	b8 00 00 00 00       	mov    $0x0,%eax
8010244e:	eb 03                	jmp    80102453 <namex+0x115>
  }
  return ip;
80102450:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
80102453:	c9                   	leave  
80102454:	c3                   	ret    

80102455 <namei>:

struct inode*
namei(char *path)
{
80102455:	55                   	push   %ebp
80102456:	89 e5                	mov    %esp,%ebp
80102458:	83 ec 28             	sub    $0x28,%esp
  char name[DIRSIZ];
  return namex(path, 0, name);
8010245b:	8d 45 ea             	lea    -0x16(%ebp),%eax
8010245e:	89 44 24 08          	mov    %eax,0x8(%esp)
80102462:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
80102469:	00 
8010246a:	8b 45 08             	mov    0x8(%ebp),%eax
8010246d:	89 04 24             	mov    %eax,(%esp)
80102470:	e8 c9 fe ff ff       	call   8010233e <namex>
}
80102475:	c9                   	leave  
80102476:	c3                   	ret    

80102477 <nameiparent>:

struct inode*
nameiparent(char *path, char *name)
{
80102477:	55                   	push   %ebp
80102478:	89 e5                	mov    %esp,%ebp
8010247a:	83 ec 18             	sub    $0x18,%esp
  return namex(path, 1, name);
8010247d:	8b 45 0c             	mov    0xc(%ebp),%eax
80102480:	89 44 24 08          	mov    %eax,0x8(%esp)
80102484:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
8010248b:	00 
8010248c:	8b 45 08             	mov    0x8(%ebp),%eax
8010248f:	89 04 24             	mov    %eax,(%esp)
80102492:	e8 a7 fe ff ff       	call   8010233e <namex>
}
80102497:	c9                   	leave  
80102498:	c3                   	ret    
80102499:	66 90                	xchg   %ax,%ax
8010249b:	90                   	nop

8010249c <inb>:
// Routines to let C code use special x86 instructions.

static inline uchar
inb(ushort port)
{
8010249c:	55                   	push   %ebp
8010249d:	89 e5                	mov    %esp,%ebp
8010249f:	53                   	push   %ebx
801024a0:	83 ec 14             	sub    $0x14,%esp
801024a3:	8b 45 08             	mov    0x8(%ebp),%eax
801024a6:	66 89 45 e8          	mov    %ax,-0x18(%ebp)
  uchar data;

  asm volatile("in %1,%0" : "=a" (data) : "d" (port));
801024aa:	0f b7 55 e8          	movzwl -0x18(%ebp),%edx
801024ae:	66 89 55 ea          	mov    %dx,-0x16(%ebp)
801024b2:	0f b7 55 ea          	movzwl -0x16(%ebp),%edx
801024b6:	ec                   	in     (%dx),%al
801024b7:	89 c3                	mov    %eax,%ebx
801024b9:	88 5d fb             	mov    %bl,-0x5(%ebp)
  return data;
801024bc:	0f b6 45 fb          	movzbl -0x5(%ebp),%eax
}
801024c0:	83 c4 14             	add    $0x14,%esp
801024c3:	5b                   	pop    %ebx
801024c4:	5d                   	pop    %ebp
801024c5:	c3                   	ret    

801024c6 <insl>:

static inline void
insl(int port, void *addr, int cnt)
{
801024c6:	55                   	push   %ebp
801024c7:	89 e5                	mov    %esp,%ebp
801024c9:	57                   	push   %edi
801024ca:	53                   	push   %ebx
  asm volatile("cld; rep insl" :
801024cb:	8b 55 08             	mov    0x8(%ebp),%edx
801024ce:	8b 4d 0c             	mov    0xc(%ebp),%ecx
801024d1:	8b 45 10             	mov    0x10(%ebp),%eax
801024d4:	89 cb                	mov    %ecx,%ebx
801024d6:	89 df                	mov    %ebx,%edi
801024d8:	89 c1                	mov    %eax,%ecx
801024da:	fc                   	cld    
801024db:	f3 6d                	rep insl (%dx),%es:(%edi)
801024dd:	89 c8                	mov    %ecx,%eax
801024df:	89 fb                	mov    %edi,%ebx
801024e1:	89 5d 0c             	mov    %ebx,0xc(%ebp)
801024e4:	89 45 10             	mov    %eax,0x10(%ebp)
               "=D" (addr), "=c" (cnt) :
               "d" (port), "0" (addr), "1" (cnt) :
               "memory", "cc");
}
801024e7:	5b                   	pop    %ebx
801024e8:	5f                   	pop    %edi
801024e9:	5d                   	pop    %ebp
801024ea:	c3                   	ret    

801024eb <outb>:

static inline void
outb(ushort port, uchar data)
{
801024eb:	55                   	push   %ebp
801024ec:	89 e5                	mov    %esp,%ebp
801024ee:	83 ec 08             	sub    $0x8,%esp
801024f1:	8b 55 08             	mov    0x8(%ebp),%edx
801024f4:	8b 45 0c             	mov    0xc(%ebp),%eax
801024f7:	66 89 55 fc          	mov    %dx,-0x4(%ebp)
801024fb:	88 45 f8             	mov    %al,-0x8(%ebp)
  asm volatile("out %0,%1" : : "a" (data), "d" (port));
801024fe:	0f b6 45 f8          	movzbl -0x8(%ebp),%eax
80102502:	0f b7 55 fc          	movzwl -0x4(%ebp),%edx
80102506:	ee                   	out    %al,(%dx)
}
80102507:	c9                   	leave  
80102508:	c3                   	ret    

80102509 <outsl>:
  asm volatile("out %0,%1" : : "a" (data), "d" (port));
}

static inline void
outsl(int port, const void *addr, int cnt)
{
80102509:	55                   	push   %ebp
8010250a:	89 e5                	mov    %esp,%ebp
8010250c:	56                   	push   %esi
8010250d:	53                   	push   %ebx
  asm volatile("cld; rep outsl" :
8010250e:	8b 55 08             	mov    0x8(%ebp),%edx
80102511:	8b 4d 0c             	mov    0xc(%ebp),%ecx
80102514:	8b 45 10             	mov    0x10(%ebp),%eax
80102517:	89 cb                	mov    %ecx,%ebx
80102519:	89 de                	mov    %ebx,%esi
8010251b:	89 c1                	mov    %eax,%ecx
8010251d:	fc                   	cld    
8010251e:	f3 6f                	rep outsl %ds:(%esi),(%dx)
80102520:	89 c8                	mov    %ecx,%eax
80102522:	89 f3                	mov    %esi,%ebx
80102524:	89 5d 0c             	mov    %ebx,0xc(%ebp)
80102527:	89 45 10             	mov    %eax,0x10(%ebp)
               "=S" (addr), "=c" (cnt) :
               "d" (port), "0" (addr), "1" (cnt) :
               "cc");
}
8010252a:	5b                   	pop    %ebx
8010252b:	5e                   	pop    %esi
8010252c:	5d                   	pop    %ebp
8010252d:	c3                   	ret    

8010252e <idewait>:
static void idestart(struct buf*);

// Wait for IDE disk to become ready.
static int
idewait(int checkerr)
{
8010252e:	55                   	push   %ebp
8010252f:	89 e5                	mov    %esp,%ebp
80102531:	83 ec 14             	sub    $0x14,%esp
  int r;

  while(((r = inb(0x1f7)) & (IDE_BSY|IDE_DRDY)) != IDE_DRDY) 
80102534:	90                   	nop
80102535:	c7 04 24 f7 01 00 00 	movl   $0x1f7,(%esp)
8010253c:	e8 5b ff ff ff       	call   8010249c <inb>
80102541:	0f b6 c0             	movzbl %al,%eax
80102544:	89 45 fc             	mov    %eax,-0x4(%ebp)
80102547:	8b 45 fc             	mov    -0x4(%ebp),%eax
8010254a:	25 c0 00 00 00       	and    $0xc0,%eax
8010254f:	83 f8 40             	cmp    $0x40,%eax
80102552:	75 e1                	jne    80102535 <idewait+0x7>
    ;
  if(checkerr && (r & (IDE_DF|IDE_ERR)) != 0)
80102554:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
80102558:	74 11                	je     8010256b <idewait+0x3d>
8010255a:	8b 45 fc             	mov    -0x4(%ebp),%eax
8010255d:	83 e0 21             	and    $0x21,%eax
80102560:	85 c0                	test   %eax,%eax
80102562:	74 07                	je     8010256b <idewait+0x3d>
    return -1;
80102564:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80102569:	eb 05                	jmp    80102570 <idewait+0x42>
  return 0;
8010256b:	b8 00 00 00 00       	mov    $0x0,%eax
}
80102570:	c9                   	leave  
80102571:	c3                   	ret    

80102572 <ideinit>:

void
ideinit(void)
{
80102572:	55                   	push   %ebp
80102573:	89 e5                	mov    %esp,%ebp
80102575:	83 ec 28             	sub    $0x28,%esp
  int i;

  initlock(&idelock, "ide");
80102578:	c7 44 24 04 48 88 10 	movl   $0x80108848,0x4(%esp)
8010257f:	80 
80102580:	c7 04 24 40 b6 10 80 	movl   $0x8010b640,(%esp)
80102587:	e8 6a 2a 00 00       	call   80104ff6 <initlock>
  picenable(IRQ_IDE);
8010258c:	c7 04 24 0e 00 00 00 	movl   $0xe,(%esp)
80102593:	e8 85 15 00 00       	call   80103b1d <picenable>
  ioapicenable(IRQ_IDE, ncpu - 1);
80102598:	a1 40 ff 10 80       	mov    0x8010ff40,%eax
8010259d:	83 e8 01             	sub    $0x1,%eax
801025a0:	89 44 24 04          	mov    %eax,0x4(%esp)
801025a4:	c7 04 24 0e 00 00 00 	movl   $0xe,(%esp)
801025ab:	e8 12 04 00 00       	call   801029c2 <ioapicenable>
  idewait(0);
801025b0:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
801025b7:	e8 72 ff ff ff       	call   8010252e <idewait>
  
  // Check if disk 1 is present
  outb(0x1f6, 0xe0 | (1<<4));
801025bc:	c7 44 24 04 f0 00 00 	movl   $0xf0,0x4(%esp)
801025c3:	00 
801025c4:	c7 04 24 f6 01 00 00 	movl   $0x1f6,(%esp)
801025cb:	e8 1b ff ff ff       	call   801024eb <outb>
  for(i=0; i<1000; i++){
801025d0:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
801025d7:	eb 20                	jmp    801025f9 <ideinit+0x87>
    if(inb(0x1f7) != 0){
801025d9:	c7 04 24 f7 01 00 00 	movl   $0x1f7,(%esp)
801025e0:	e8 b7 fe ff ff       	call   8010249c <inb>
801025e5:	84 c0                	test   %al,%al
801025e7:	74 0c                	je     801025f5 <ideinit+0x83>
      havedisk1 = 1;
801025e9:	c7 05 78 b6 10 80 01 	movl   $0x1,0x8010b678
801025f0:	00 00 00 
      break;
801025f3:	eb 0d                	jmp    80102602 <ideinit+0x90>
  ioapicenable(IRQ_IDE, ncpu - 1);
  idewait(0);
  
  // Check if disk 1 is present
  outb(0x1f6, 0xe0 | (1<<4));
  for(i=0; i<1000; i++){
801025f5:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
801025f9:	81 7d f4 e7 03 00 00 	cmpl   $0x3e7,-0xc(%ebp)
80102600:	7e d7                	jle    801025d9 <ideinit+0x67>
      break;
    }
  }
  
  // Switch back to disk 0.
  outb(0x1f6, 0xe0 | (0<<4));
80102602:	c7 44 24 04 e0 00 00 	movl   $0xe0,0x4(%esp)
80102609:	00 
8010260a:	c7 04 24 f6 01 00 00 	movl   $0x1f6,(%esp)
80102611:	e8 d5 fe ff ff       	call   801024eb <outb>
}
80102616:	c9                   	leave  
80102617:	c3                   	ret    

80102618 <idestart>:

// Start the request for b.  Caller must hold idelock.
static void
idestart(struct buf *b)
{
80102618:	55                   	push   %ebp
80102619:	89 e5                	mov    %esp,%ebp
8010261b:	83 ec 18             	sub    $0x18,%esp
  if(b == 0)
8010261e:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
80102622:	75 0c                	jne    80102630 <idestart+0x18>
    panic("idestart");
80102624:	c7 04 24 4c 88 10 80 	movl   $0x8010884c,(%esp)
8010262b:	e8 16 df ff ff       	call   80100546 <panic>

  idewait(0);
80102630:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
80102637:	e8 f2 fe ff ff       	call   8010252e <idewait>
  outb(0x3f6, 0);  // generate interrupt
8010263c:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
80102643:	00 
80102644:	c7 04 24 f6 03 00 00 	movl   $0x3f6,(%esp)
8010264b:	e8 9b fe ff ff       	call   801024eb <outb>
  outb(0x1f2, 1);  // number of sectors
80102650:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
80102657:	00 
80102658:	c7 04 24 f2 01 00 00 	movl   $0x1f2,(%esp)
8010265f:	e8 87 fe ff ff       	call   801024eb <outb>
  outb(0x1f3, b->sector & 0xff);
80102664:	8b 45 08             	mov    0x8(%ebp),%eax
80102667:	8b 40 08             	mov    0x8(%eax),%eax
8010266a:	0f b6 c0             	movzbl %al,%eax
8010266d:	89 44 24 04          	mov    %eax,0x4(%esp)
80102671:	c7 04 24 f3 01 00 00 	movl   $0x1f3,(%esp)
80102678:	e8 6e fe ff ff       	call   801024eb <outb>
  outb(0x1f4, (b->sector >> 8) & 0xff);
8010267d:	8b 45 08             	mov    0x8(%ebp),%eax
80102680:	8b 40 08             	mov    0x8(%eax),%eax
80102683:	c1 e8 08             	shr    $0x8,%eax
80102686:	0f b6 c0             	movzbl %al,%eax
80102689:	89 44 24 04          	mov    %eax,0x4(%esp)
8010268d:	c7 04 24 f4 01 00 00 	movl   $0x1f4,(%esp)
80102694:	e8 52 fe ff ff       	call   801024eb <outb>
  outb(0x1f5, (b->sector >> 16) & 0xff);
80102699:	8b 45 08             	mov    0x8(%ebp),%eax
8010269c:	8b 40 08             	mov    0x8(%eax),%eax
8010269f:	c1 e8 10             	shr    $0x10,%eax
801026a2:	0f b6 c0             	movzbl %al,%eax
801026a5:	89 44 24 04          	mov    %eax,0x4(%esp)
801026a9:	c7 04 24 f5 01 00 00 	movl   $0x1f5,(%esp)
801026b0:	e8 36 fe ff ff       	call   801024eb <outb>
  outb(0x1f6, 0xe0 | ((b->dev&1)<<4) | ((b->sector>>24)&0x0f));
801026b5:	8b 45 08             	mov    0x8(%ebp),%eax
801026b8:	8b 40 04             	mov    0x4(%eax),%eax
801026bb:	83 e0 01             	and    $0x1,%eax
801026be:	89 c2                	mov    %eax,%edx
801026c0:	c1 e2 04             	shl    $0x4,%edx
801026c3:	8b 45 08             	mov    0x8(%ebp),%eax
801026c6:	8b 40 08             	mov    0x8(%eax),%eax
801026c9:	c1 e8 18             	shr    $0x18,%eax
801026cc:	83 e0 0f             	and    $0xf,%eax
801026cf:	09 d0                	or     %edx,%eax
801026d1:	83 c8 e0             	or     $0xffffffe0,%eax
801026d4:	0f b6 c0             	movzbl %al,%eax
801026d7:	89 44 24 04          	mov    %eax,0x4(%esp)
801026db:	c7 04 24 f6 01 00 00 	movl   $0x1f6,(%esp)
801026e2:	e8 04 fe ff ff       	call   801024eb <outb>
  if(b->flags & B_DIRTY){
801026e7:	8b 45 08             	mov    0x8(%ebp),%eax
801026ea:	8b 00                	mov    (%eax),%eax
801026ec:	83 e0 04             	and    $0x4,%eax
801026ef:	85 c0                	test   %eax,%eax
801026f1:	74 34                	je     80102727 <idestart+0x10f>
    outb(0x1f7, IDE_CMD_WRITE);
801026f3:	c7 44 24 04 30 00 00 	movl   $0x30,0x4(%esp)
801026fa:	00 
801026fb:	c7 04 24 f7 01 00 00 	movl   $0x1f7,(%esp)
80102702:	e8 e4 fd ff ff       	call   801024eb <outb>
    outsl(0x1f0, b->data, 512/4);
80102707:	8b 45 08             	mov    0x8(%ebp),%eax
8010270a:	83 c0 18             	add    $0x18,%eax
8010270d:	c7 44 24 08 80 00 00 	movl   $0x80,0x8(%esp)
80102714:	00 
80102715:	89 44 24 04          	mov    %eax,0x4(%esp)
80102719:	c7 04 24 f0 01 00 00 	movl   $0x1f0,(%esp)
80102720:	e8 e4 fd ff ff       	call   80102509 <outsl>
80102725:	eb 14                	jmp    8010273b <idestart+0x123>
  } else {
    outb(0x1f7, IDE_CMD_READ);
80102727:	c7 44 24 04 20 00 00 	movl   $0x20,0x4(%esp)
8010272e:	00 
8010272f:	c7 04 24 f7 01 00 00 	movl   $0x1f7,(%esp)
80102736:	e8 b0 fd ff ff       	call   801024eb <outb>
  }
}
8010273b:	c9                   	leave  
8010273c:	c3                   	ret    

8010273d <ideintr>:

// Interrupt handler.
void
ideintr(void)
{
8010273d:	55                   	push   %ebp
8010273e:	89 e5                	mov    %esp,%ebp
80102740:	83 ec 28             	sub    $0x28,%esp
  struct buf *b;

  // First queued buffer is the active request.
  acquire(&idelock);
80102743:	c7 04 24 40 b6 10 80 	movl   $0x8010b640,(%esp)
8010274a:	e8 c8 28 00 00       	call   80105017 <acquire>
  if((b = idequeue) == 0){
8010274f:	a1 74 b6 10 80       	mov    0x8010b674,%eax
80102754:	89 45 f4             	mov    %eax,-0xc(%ebp)
80102757:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
8010275b:	75 11                	jne    8010276e <ideintr+0x31>
    release(&idelock);
8010275d:	c7 04 24 40 b6 10 80 	movl   $0x8010b640,(%esp)
80102764:	e8 10 29 00 00       	call   80105079 <release>
    // cprintf("spurious IDE interrupt\n");
    return;
80102769:	e9 90 00 00 00       	jmp    801027fe <ideintr+0xc1>
  }
  idequeue = b->qnext;
8010276e:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102771:	8b 40 14             	mov    0x14(%eax),%eax
80102774:	a3 74 b6 10 80       	mov    %eax,0x8010b674

  // Read data if needed.
  if(!(b->flags & B_DIRTY) && idewait(1) >= 0)
80102779:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010277c:	8b 00                	mov    (%eax),%eax
8010277e:	83 e0 04             	and    $0x4,%eax
80102781:	85 c0                	test   %eax,%eax
80102783:	75 2e                	jne    801027b3 <ideintr+0x76>
80102785:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
8010278c:	e8 9d fd ff ff       	call   8010252e <idewait>
80102791:	85 c0                	test   %eax,%eax
80102793:	78 1e                	js     801027b3 <ideintr+0x76>
    insl(0x1f0, b->data, 512/4);
80102795:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102798:	83 c0 18             	add    $0x18,%eax
8010279b:	c7 44 24 08 80 00 00 	movl   $0x80,0x8(%esp)
801027a2:	00 
801027a3:	89 44 24 04          	mov    %eax,0x4(%esp)
801027a7:	c7 04 24 f0 01 00 00 	movl   $0x1f0,(%esp)
801027ae:	e8 13 fd ff ff       	call   801024c6 <insl>
  
  // Wake process waiting for this buf.
  b->flags |= B_VALID;
801027b3:	8b 45 f4             	mov    -0xc(%ebp),%eax
801027b6:	8b 00                	mov    (%eax),%eax
801027b8:	89 c2                	mov    %eax,%edx
801027ba:	83 ca 02             	or     $0x2,%edx
801027bd:	8b 45 f4             	mov    -0xc(%ebp),%eax
801027c0:	89 10                	mov    %edx,(%eax)
  b->flags &= ~B_DIRTY;
801027c2:	8b 45 f4             	mov    -0xc(%ebp),%eax
801027c5:	8b 00                	mov    (%eax),%eax
801027c7:	89 c2                	mov    %eax,%edx
801027c9:	83 e2 fb             	and    $0xfffffffb,%edx
801027cc:	8b 45 f4             	mov    -0xc(%ebp),%eax
801027cf:	89 10                	mov    %edx,(%eax)
  wakeup(b);
801027d1:	8b 45 f4             	mov    -0xc(%ebp),%eax
801027d4:	89 04 24             	mov    %eax,(%esp)
801027d7:	e8 42 23 00 00       	call   80104b1e <wakeup>
  
  // Start disk on next buf in queue.
  if(idequeue != 0)
801027dc:	a1 74 b6 10 80       	mov    0x8010b674,%eax
801027e1:	85 c0                	test   %eax,%eax
801027e3:	74 0d                	je     801027f2 <ideintr+0xb5>
    idestart(idequeue);
801027e5:	a1 74 b6 10 80       	mov    0x8010b674,%eax
801027ea:	89 04 24             	mov    %eax,(%esp)
801027ed:	e8 26 fe ff ff       	call   80102618 <idestart>

  release(&idelock);
801027f2:	c7 04 24 40 b6 10 80 	movl   $0x8010b640,(%esp)
801027f9:	e8 7b 28 00 00       	call   80105079 <release>
}
801027fe:	c9                   	leave  
801027ff:	c3                   	ret    

80102800 <iderw>:
// Sync buf with disk. 
// If B_DIRTY is set, write buf to disk, clear B_DIRTY, set B_VALID.
// Else if B_VALID is not set, read buf from disk, set B_VALID.
void
iderw(struct buf *b)
{
80102800:	55                   	push   %ebp
80102801:	89 e5                	mov    %esp,%ebp
80102803:	83 ec 28             	sub    $0x28,%esp
  struct buf **pp;

  if(!(b->flags & B_BUSY))
80102806:	8b 45 08             	mov    0x8(%ebp),%eax
80102809:	8b 00                	mov    (%eax),%eax
8010280b:	83 e0 01             	and    $0x1,%eax
8010280e:	85 c0                	test   %eax,%eax
80102810:	75 0c                	jne    8010281e <iderw+0x1e>
    panic("iderw: buf not busy");
80102812:	c7 04 24 55 88 10 80 	movl   $0x80108855,(%esp)
80102819:	e8 28 dd ff ff       	call   80100546 <panic>
  if((b->flags & (B_VALID|B_DIRTY)) == B_VALID)
8010281e:	8b 45 08             	mov    0x8(%ebp),%eax
80102821:	8b 00                	mov    (%eax),%eax
80102823:	83 e0 06             	and    $0x6,%eax
80102826:	83 f8 02             	cmp    $0x2,%eax
80102829:	75 0c                	jne    80102837 <iderw+0x37>
    panic("iderw: nothing to do");
8010282b:	c7 04 24 69 88 10 80 	movl   $0x80108869,(%esp)
80102832:	e8 0f dd ff ff       	call   80100546 <panic>
  if(b->dev != 0 && !havedisk1)
80102837:	8b 45 08             	mov    0x8(%ebp),%eax
8010283a:	8b 40 04             	mov    0x4(%eax),%eax
8010283d:	85 c0                	test   %eax,%eax
8010283f:	74 15                	je     80102856 <iderw+0x56>
80102841:	a1 78 b6 10 80       	mov    0x8010b678,%eax
80102846:	85 c0                	test   %eax,%eax
80102848:	75 0c                	jne    80102856 <iderw+0x56>
    panic("iderw: ide disk 1 not present");
8010284a:	c7 04 24 7e 88 10 80 	movl   $0x8010887e,(%esp)
80102851:	e8 f0 dc ff ff       	call   80100546 <panic>

  acquire(&idelock);  //DOC: acquire-lock
80102856:	c7 04 24 40 b6 10 80 	movl   $0x8010b640,(%esp)
8010285d:	e8 b5 27 00 00       	call   80105017 <acquire>

  // Append b to idequeue.
  b->qnext = 0;
80102862:	8b 45 08             	mov    0x8(%ebp),%eax
80102865:	c7 40 14 00 00 00 00 	movl   $0x0,0x14(%eax)
  for(pp=&idequeue; *pp; pp=&(*pp)->qnext)  //DOC: insert-queue
8010286c:	c7 45 f4 74 b6 10 80 	movl   $0x8010b674,-0xc(%ebp)
80102873:	eb 0b                	jmp    80102880 <iderw+0x80>
80102875:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102878:	8b 00                	mov    (%eax),%eax
8010287a:	83 c0 14             	add    $0x14,%eax
8010287d:	89 45 f4             	mov    %eax,-0xc(%ebp)
80102880:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102883:	8b 00                	mov    (%eax),%eax
80102885:	85 c0                	test   %eax,%eax
80102887:	75 ec                	jne    80102875 <iderw+0x75>
    ;
  *pp = b;
80102889:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010288c:	8b 55 08             	mov    0x8(%ebp),%edx
8010288f:	89 10                	mov    %edx,(%eax)
  
  // Start disk if necessary.
  if(idequeue == b)
80102891:	a1 74 b6 10 80       	mov    0x8010b674,%eax
80102896:	3b 45 08             	cmp    0x8(%ebp),%eax
80102899:	75 22                	jne    801028bd <iderw+0xbd>
    idestart(b);
8010289b:	8b 45 08             	mov    0x8(%ebp),%eax
8010289e:	89 04 24             	mov    %eax,(%esp)
801028a1:	e8 72 fd ff ff       	call   80102618 <idestart>
  
  // Wait for request to finish.
  while((b->flags & (B_VALID|B_DIRTY)) != B_VALID){
801028a6:	eb 15                	jmp    801028bd <iderw+0xbd>
    sleep(b, &idelock);
801028a8:	c7 44 24 04 40 b6 10 	movl   $0x8010b640,0x4(%esp)
801028af:	80 
801028b0:	8b 45 08             	mov    0x8(%ebp),%eax
801028b3:	89 04 24             	mov    %eax,(%esp)
801028b6:	e8 87 21 00 00       	call   80104a42 <sleep>
801028bb:	eb 01                	jmp    801028be <iderw+0xbe>
  // Start disk if necessary.
  if(idequeue == b)
    idestart(b);
  
  // Wait for request to finish.
  while((b->flags & (B_VALID|B_DIRTY)) != B_VALID){
801028bd:	90                   	nop
801028be:	8b 45 08             	mov    0x8(%ebp),%eax
801028c1:	8b 00                	mov    (%eax),%eax
801028c3:	83 e0 06             	and    $0x6,%eax
801028c6:	83 f8 02             	cmp    $0x2,%eax
801028c9:	75 dd                	jne    801028a8 <iderw+0xa8>
    sleep(b, &idelock);
  }

  release(&idelock);
801028cb:	c7 04 24 40 b6 10 80 	movl   $0x8010b640,(%esp)
801028d2:	e8 a2 27 00 00       	call   80105079 <release>
}
801028d7:	c9                   	leave  
801028d8:	c3                   	ret    
801028d9:	66 90                	xchg   %ax,%ax
801028db:	90                   	nop

801028dc <ioapicread>:
  uint data;
};

static uint
ioapicread(int reg)
{
801028dc:	55                   	push   %ebp
801028dd:	89 e5                	mov    %esp,%ebp
  ioapic->reg = reg;
801028df:	a1 74 f8 10 80       	mov    0x8010f874,%eax
801028e4:	8b 55 08             	mov    0x8(%ebp),%edx
801028e7:	89 10                	mov    %edx,(%eax)
  return ioapic->data;
801028e9:	a1 74 f8 10 80       	mov    0x8010f874,%eax
801028ee:	8b 40 10             	mov    0x10(%eax),%eax
}
801028f1:	5d                   	pop    %ebp
801028f2:	c3                   	ret    

801028f3 <ioapicwrite>:

static void
ioapicwrite(int reg, uint data)
{
801028f3:	55                   	push   %ebp
801028f4:	89 e5                	mov    %esp,%ebp
  ioapic->reg = reg;
801028f6:	a1 74 f8 10 80       	mov    0x8010f874,%eax
801028fb:	8b 55 08             	mov    0x8(%ebp),%edx
801028fe:	89 10                	mov    %edx,(%eax)
  ioapic->data = data;
80102900:	a1 74 f8 10 80       	mov    0x8010f874,%eax
80102905:	8b 55 0c             	mov    0xc(%ebp),%edx
80102908:	89 50 10             	mov    %edx,0x10(%eax)
}
8010290b:	5d                   	pop    %ebp
8010290c:	c3                   	ret    

8010290d <ioapicinit>:

void
ioapicinit(void)
{
8010290d:	55                   	push   %ebp
8010290e:	89 e5                	mov    %esp,%ebp
80102910:	83 ec 28             	sub    $0x28,%esp
  int i, id, maxintr;

  if(!ismp)
80102913:	a1 44 f9 10 80       	mov    0x8010f944,%eax
80102918:	85 c0                	test   %eax,%eax
8010291a:	0f 84 9f 00 00 00    	je     801029bf <ioapicinit+0xb2>
    return;

  ioapic = (volatile struct ioapic*)IOAPIC;
80102920:	c7 05 74 f8 10 80 00 	movl   $0xfec00000,0x8010f874
80102927:	00 c0 fe 
  maxintr = (ioapicread(REG_VER) >> 16) & 0xFF;
8010292a:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
80102931:	e8 a6 ff ff ff       	call   801028dc <ioapicread>
80102936:	c1 e8 10             	shr    $0x10,%eax
80102939:	25 ff 00 00 00       	and    $0xff,%eax
8010293e:	89 45 f0             	mov    %eax,-0x10(%ebp)
  id = ioapicread(REG_ID) >> 24;
80102941:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
80102948:	e8 8f ff ff ff       	call   801028dc <ioapicread>
8010294d:	c1 e8 18             	shr    $0x18,%eax
80102950:	89 45 ec             	mov    %eax,-0x14(%ebp)
  if(id != ioapicid)
80102953:	0f b6 05 40 f9 10 80 	movzbl 0x8010f940,%eax
8010295a:	0f b6 c0             	movzbl %al,%eax
8010295d:	3b 45 ec             	cmp    -0x14(%ebp),%eax
80102960:	74 0c                	je     8010296e <ioapicinit+0x61>
    cprintf("ioapicinit: id isn't equal to ioapicid; not a MP\n");
80102962:	c7 04 24 9c 88 10 80 	movl   $0x8010889c,(%esp)
80102969:	e8 3c da ff ff       	call   801003aa <cprintf>

  // Mark all interrupts edge-triggered, active high, disabled,
  // and not routed to any CPUs.
  for(i = 0; i <= maxintr; i++){
8010296e:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
80102975:	eb 3e                	jmp    801029b5 <ioapicinit+0xa8>
    ioapicwrite(REG_TABLE+2*i, INT_DISABLED | (T_IRQ0 + i));
80102977:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010297a:	83 c0 20             	add    $0x20,%eax
8010297d:	0d 00 00 01 00       	or     $0x10000,%eax
80102982:	8b 55 f4             	mov    -0xc(%ebp),%edx
80102985:	83 c2 08             	add    $0x8,%edx
80102988:	01 d2                	add    %edx,%edx
8010298a:	89 44 24 04          	mov    %eax,0x4(%esp)
8010298e:	89 14 24             	mov    %edx,(%esp)
80102991:	e8 5d ff ff ff       	call   801028f3 <ioapicwrite>
    ioapicwrite(REG_TABLE+2*i+1, 0);
80102996:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102999:	83 c0 08             	add    $0x8,%eax
8010299c:	01 c0                	add    %eax,%eax
8010299e:	83 c0 01             	add    $0x1,%eax
801029a1:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
801029a8:	00 
801029a9:	89 04 24             	mov    %eax,(%esp)
801029ac:	e8 42 ff ff ff       	call   801028f3 <ioapicwrite>
  if(id != ioapicid)
    cprintf("ioapicinit: id isn't equal to ioapicid; not a MP\n");

  // Mark all interrupts edge-triggered, active high, disabled,
  // and not routed to any CPUs.
  for(i = 0; i <= maxintr; i++){
801029b1:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
801029b5:	8b 45 f4             	mov    -0xc(%ebp),%eax
801029b8:	3b 45 f0             	cmp    -0x10(%ebp),%eax
801029bb:	7e ba                	jle    80102977 <ioapicinit+0x6a>
801029bd:	eb 01                	jmp    801029c0 <ioapicinit+0xb3>
ioapicinit(void)
{
  int i, id, maxintr;

  if(!ismp)
    return;
801029bf:	90                   	nop
  // and not routed to any CPUs.
  for(i = 0; i <= maxintr; i++){
    ioapicwrite(REG_TABLE+2*i, INT_DISABLED | (T_IRQ0 + i));
    ioapicwrite(REG_TABLE+2*i+1, 0);
  }
}
801029c0:	c9                   	leave  
801029c1:	c3                   	ret    

801029c2 <ioapicenable>:

void
ioapicenable(int irq, int cpunum)
{
801029c2:	55                   	push   %ebp
801029c3:	89 e5                	mov    %esp,%ebp
801029c5:	83 ec 08             	sub    $0x8,%esp
  if(!ismp)
801029c8:	a1 44 f9 10 80       	mov    0x8010f944,%eax
801029cd:	85 c0                	test   %eax,%eax
801029cf:	74 39                	je     80102a0a <ioapicenable+0x48>
    return;

  // Mark interrupt edge-triggered, active high,
  // enabled, and routed to the given cpunum,
  // which happens to be that cpu's APIC ID.
  ioapicwrite(REG_TABLE+2*irq, T_IRQ0 + irq);
801029d1:	8b 45 08             	mov    0x8(%ebp),%eax
801029d4:	83 c0 20             	add    $0x20,%eax
801029d7:	8b 55 08             	mov    0x8(%ebp),%edx
801029da:	83 c2 08             	add    $0x8,%edx
801029dd:	01 d2                	add    %edx,%edx
801029df:	89 44 24 04          	mov    %eax,0x4(%esp)
801029e3:	89 14 24             	mov    %edx,(%esp)
801029e6:	e8 08 ff ff ff       	call   801028f3 <ioapicwrite>
  ioapicwrite(REG_TABLE+2*irq+1, cpunum << 24);
801029eb:	8b 45 0c             	mov    0xc(%ebp),%eax
801029ee:	c1 e0 18             	shl    $0x18,%eax
801029f1:	8b 55 08             	mov    0x8(%ebp),%edx
801029f4:	83 c2 08             	add    $0x8,%edx
801029f7:	01 d2                	add    %edx,%edx
801029f9:	83 c2 01             	add    $0x1,%edx
801029fc:	89 44 24 04          	mov    %eax,0x4(%esp)
80102a00:	89 14 24             	mov    %edx,(%esp)
80102a03:	e8 eb fe ff ff       	call   801028f3 <ioapicwrite>
80102a08:	eb 01                	jmp    80102a0b <ioapicenable+0x49>

void
ioapicenable(int irq, int cpunum)
{
  if(!ismp)
    return;
80102a0a:	90                   	nop
  // Mark interrupt edge-triggered, active high,
  // enabled, and routed to the given cpunum,
  // which happens to be that cpu's APIC ID.
  ioapicwrite(REG_TABLE+2*irq, T_IRQ0 + irq);
  ioapicwrite(REG_TABLE+2*irq+1, cpunum << 24);
}
80102a0b:	c9                   	leave  
80102a0c:	c3                   	ret    
80102a0d:	66 90                	xchg   %ax,%ax
80102a0f:	90                   	nop

80102a10 <v2p>:
#define KERNBASE 0x80000000         // First kernel virtual address
#define KERNLINK (KERNBASE+EXTMEM)  // Address where kernel is linked

#ifndef __ASSEMBLER__

static inline uint v2p(void *a) { return ((uint) (a))  - KERNBASE; }
80102a10:	55                   	push   %ebp
80102a11:	89 e5                	mov    %esp,%ebp
80102a13:	8b 45 08             	mov    0x8(%ebp),%eax
80102a16:	05 00 00 00 80       	add    $0x80000000,%eax
80102a1b:	5d                   	pop    %ebp
80102a1c:	c3                   	ret    

80102a1d <kinit1>:
// the pages mapped by entrypgdir on free list.
// 2. main() calls kinit2() with the rest of the physical pages
// after installing a full page table that maps them on all cores.
void
kinit1(void *vstart, void *vend)
{
80102a1d:	55                   	push   %ebp
80102a1e:	89 e5                	mov    %esp,%ebp
80102a20:	83 ec 18             	sub    $0x18,%esp
  initlock(&kmem.lock, "kmem");
80102a23:	c7 44 24 04 ce 88 10 	movl   $0x801088ce,0x4(%esp)
80102a2a:	80 
80102a2b:	c7 04 24 80 f8 10 80 	movl   $0x8010f880,(%esp)
80102a32:	e8 bf 25 00 00       	call   80104ff6 <initlock>
  kmem.use_lock = 0;
80102a37:	c7 05 b4 f8 10 80 00 	movl   $0x0,0x8010f8b4
80102a3e:	00 00 00 
  freerange(vstart, vend);
80102a41:	8b 45 0c             	mov    0xc(%ebp),%eax
80102a44:	89 44 24 04          	mov    %eax,0x4(%esp)
80102a48:	8b 45 08             	mov    0x8(%ebp),%eax
80102a4b:	89 04 24             	mov    %eax,(%esp)
80102a4e:	e8 26 00 00 00       	call   80102a79 <freerange>
}
80102a53:	c9                   	leave  
80102a54:	c3                   	ret    

80102a55 <kinit2>:

void
kinit2(void *vstart, void *vend)
{
80102a55:	55                   	push   %ebp
80102a56:	89 e5                	mov    %esp,%ebp
80102a58:	83 ec 18             	sub    $0x18,%esp
  freerange(vstart, vend);
80102a5b:	8b 45 0c             	mov    0xc(%ebp),%eax
80102a5e:	89 44 24 04          	mov    %eax,0x4(%esp)
80102a62:	8b 45 08             	mov    0x8(%ebp),%eax
80102a65:	89 04 24             	mov    %eax,(%esp)
80102a68:	e8 0c 00 00 00       	call   80102a79 <freerange>
  kmem.use_lock = 1;
80102a6d:	c7 05 b4 f8 10 80 01 	movl   $0x1,0x8010f8b4
80102a74:	00 00 00 
}
80102a77:	c9                   	leave  
80102a78:	c3                   	ret    

80102a79 <freerange>:

void
freerange(void *vstart, void *vend)
{
80102a79:	55                   	push   %ebp
80102a7a:	89 e5                	mov    %esp,%ebp
80102a7c:	83 ec 28             	sub    $0x28,%esp
  char *p;
  p = (char*)PGROUNDUP((uint)vstart);
80102a7f:	8b 45 08             	mov    0x8(%ebp),%eax
80102a82:	05 ff 0f 00 00       	add    $0xfff,%eax
80102a87:	25 00 f0 ff ff       	and    $0xfffff000,%eax
80102a8c:	89 45 f4             	mov    %eax,-0xc(%ebp)
  for(; p + PGSIZE <= (char*)vend; p += PGSIZE)
80102a8f:	eb 12                	jmp    80102aa3 <freerange+0x2a>
    kfree(p);
80102a91:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102a94:	89 04 24             	mov    %eax,(%esp)
80102a97:	e8 16 00 00 00       	call   80102ab2 <kfree>
void
freerange(void *vstart, void *vend)
{
  char *p;
  p = (char*)PGROUNDUP((uint)vstart);
  for(; p + PGSIZE <= (char*)vend; p += PGSIZE)
80102a9c:	81 45 f4 00 10 00 00 	addl   $0x1000,-0xc(%ebp)
80102aa3:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102aa6:	05 00 10 00 00       	add    $0x1000,%eax
80102aab:	3b 45 0c             	cmp    0xc(%ebp),%eax
80102aae:	76 e1                	jbe    80102a91 <freerange+0x18>
    kfree(p);
}
80102ab0:	c9                   	leave  
80102ab1:	c3                   	ret    

80102ab2 <kfree>:
// which normally should have been returned by a
// call to kalloc().  (The exception is when
// initializing the allocator; see kinit above.)
void
kfree(char *v)
{
80102ab2:	55                   	push   %ebp
80102ab3:	89 e5                	mov    %esp,%ebp
80102ab5:	83 ec 28             	sub    $0x28,%esp
  struct run *r;

  if((uint)v % PGSIZE || v < end || v2p(v) >= PHYSTOP)
80102ab8:	8b 45 08             	mov    0x8(%ebp),%eax
80102abb:	25 ff 0f 00 00       	and    $0xfff,%eax
80102ac0:	85 c0                	test   %eax,%eax
80102ac2:	75 1b                	jne    80102adf <kfree+0x2d>
80102ac4:	81 7d 08 3c 49 11 80 	cmpl   $0x8011493c,0x8(%ebp)
80102acb:	72 12                	jb     80102adf <kfree+0x2d>
80102acd:	8b 45 08             	mov    0x8(%ebp),%eax
80102ad0:	89 04 24             	mov    %eax,(%esp)
80102ad3:	e8 38 ff ff ff       	call   80102a10 <v2p>
80102ad8:	3d ff ff ff 0d       	cmp    $0xdffffff,%eax
80102add:	76 0c                	jbe    80102aeb <kfree+0x39>
    panic("kfree");
80102adf:	c7 04 24 d3 88 10 80 	movl   $0x801088d3,(%esp)
80102ae6:	e8 5b da ff ff       	call   80100546 <panic>

  // Fill with junk to catch dangling refs.
  memset(v, 1, PGSIZE);
80102aeb:	c7 44 24 08 00 10 00 	movl   $0x1000,0x8(%esp)
80102af2:	00 
80102af3:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
80102afa:	00 
80102afb:	8b 45 08             	mov    0x8(%ebp),%eax
80102afe:	89 04 24             	mov    %eax,(%esp)
80102b01:	e8 6c 27 00 00       	call   80105272 <memset>

  if(kmem.use_lock)
80102b06:	a1 b4 f8 10 80       	mov    0x8010f8b4,%eax
80102b0b:	85 c0                	test   %eax,%eax
80102b0d:	74 0c                	je     80102b1b <kfree+0x69>
    acquire(&kmem.lock);
80102b0f:	c7 04 24 80 f8 10 80 	movl   $0x8010f880,(%esp)
80102b16:	e8 fc 24 00 00       	call   80105017 <acquire>
  r = (struct run*)v;
80102b1b:	8b 45 08             	mov    0x8(%ebp),%eax
80102b1e:	89 45 f4             	mov    %eax,-0xc(%ebp)
  r->next = kmem.freelist;
80102b21:	8b 15 b8 f8 10 80    	mov    0x8010f8b8,%edx
80102b27:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102b2a:	89 10                	mov    %edx,(%eax)
  kmem.freelist = r;
80102b2c:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102b2f:	a3 b8 f8 10 80       	mov    %eax,0x8010f8b8
  if(kmem.use_lock)
80102b34:	a1 b4 f8 10 80       	mov    0x8010f8b4,%eax
80102b39:	85 c0                	test   %eax,%eax
80102b3b:	74 0c                	je     80102b49 <kfree+0x97>
    release(&kmem.lock);
80102b3d:	c7 04 24 80 f8 10 80 	movl   $0x8010f880,(%esp)
80102b44:	e8 30 25 00 00       	call   80105079 <release>
}
80102b49:	c9                   	leave  
80102b4a:	c3                   	ret    

80102b4b <kalloc>:
// Allocate one 4096-byte page of physical memory.
// Returns a pointer that the kernel can use.
// Returns 0 if the memory cannot be allocated.
char*
kalloc(void)
{
80102b4b:	55                   	push   %ebp
80102b4c:	89 e5                	mov    %esp,%ebp
80102b4e:	83 ec 28             	sub    $0x28,%esp
  struct run *r;

  if(kmem.use_lock)
80102b51:	a1 b4 f8 10 80       	mov    0x8010f8b4,%eax
80102b56:	85 c0                	test   %eax,%eax
80102b58:	74 0c                	je     80102b66 <kalloc+0x1b>
    acquire(&kmem.lock);
80102b5a:	c7 04 24 80 f8 10 80 	movl   $0x8010f880,(%esp)
80102b61:	e8 b1 24 00 00       	call   80105017 <acquire>
  r = kmem.freelist;
80102b66:	a1 b8 f8 10 80       	mov    0x8010f8b8,%eax
80102b6b:	89 45 f4             	mov    %eax,-0xc(%ebp)
  if(r)
80102b6e:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80102b72:	74 0a                	je     80102b7e <kalloc+0x33>
    kmem.freelist = r->next;
80102b74:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102b77:	8b 00                	mov    (%eax),%eax
80102b79:	a3 b8 f8 10 80       	mov    %eax,0x8010f8b8
  if(kmem.use_lock)
80102b7e:	a1 b4 f8 10 80       	mov    0x8010f8b4,%eax
80102b83:	85 c0                	test   %eax,%eax
80102b85:	74 0c                	je     80102b93 <kalloc+0x48>
    release(&kmem.lock);
80102b87:	c7 04 24 80 f8 10 80 	movl   $0x8010f880,(%esp)
80102b8e:	e8 e6 24 00 00       	call   80105079 <release>
  return (char*)r;
80102b93:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
80102b96:	c9                   	leave  
80102b97:	c3                   	ret    

80102b98 <inb>:
// Routines to let C code use special x86 instructions.

static inline uchar
inb(ushort port)
{
80102b98:	55                   	push   %ebp
80102b99:	89 e5                	mov    %esp,%ebp
80102b9b:	53                   	push   %ebx
80102b9c:	83 ec 14             	sub    $0x14,%esp
80102b9f:	8b 45 08             	mov    0x8(%ebp),%eax
80102ba2:	66 89 45 e8          	mov    %ax,-0x18(%ebp)
  uchar data;

  asm volatile("in %1,%0" : "=a" (data) : "d" (port));
80102ba6:	0f b7 55 e8          	movzwl -0x18(%ebp),%edx
80102baa:	66 89 55 ea          	mov    %dx,-0x16(%ebp)
80102bae:	0f b7 55 ea          	movzwl -0x16(%ebp),%edx
80102bb2:	ec                   	in     (%dx),%al
80102bb3:	89 c3                	mov    %eax,%ebx
80102bb5:	88 5d fb             	mov    %bl,-0x5(%ebp)
  return data;
80102bb8:	0f b6 45 fb          	movzbl -0x5(%ebp),%eax
}
80102bbc:	83 c4 14             	add    $0x14,%esp
80102bbf:	5b                   	pop    %ebx
80102bc0:	5d                   	pop    %ebp
80102bc1:	c3                   	ret    

80102bc2 <kbdgetc>:
#include "defs.h"
#include "kbd.h"

int
kbdgetc(void)
{
80102bc2:	55                   	push   %ebp
80102bc3:	89 e5                	mov    %esp,%ebp
80102bc5:	83 ec 14             	sub    $0x14,%esp
  static uchar *charcode[4] = {
    normalmap, shiftmap, ctlmap, ctlmap
  };
  uint st, data, c;

  st = inb(KBSTATP);
80102bc8:	c7 04 24 64 00 00 00 	movl   $0x64,(%esp)
80102bcf:	e8 c4 ff ff ff       	call   80102b98 <inb>
80102bd4:	0f b6 c0             	movzbl %al,%eax
80102bd7:	89 45 f4             	mov    %eax,-0xc(%ebp)
  if((st & KBS_DIB) == 0)
80102bda:	8b 45 f4             	mov    -0xc(%ebp),%eax
80102bdd:	83 e0 01             	and    $0x1,%eax
80102be0:	85 c0                	test   %eax,%eax
80102be2:	75 0a                	jne    80102bee <kbdgetc+0x2c>
    return -1;
80102be4:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80102be9:	e9 25 01 00 00       	jmp    80102d13 <kbdgetc+0x151>
  data = inb(KBDATAP);
80102bee:	c7 04 24 60 00 00 00 	movl   $0x60,(%esp)
80102bf5:	e8 9e ff ff ff       	call   80102b98 <inb>
80102bfa:	0f b6 c0             	movzbl %al,%eax
80102bfd:	89 45 fc             	mov    %eax,-0x4(%ebp)

  if(data == 0xE0){
80102c00:	81 7d fc e0 00 00 00 	cmpl   $0xe0,-0x4(%ebp)
80102c07:	75 17                	jne    80102c20 <kbdgetc+0x5e>
    shift |= E0ESC;
80102c09:	a1 7c b6 10 80       	mov    0x8010b67c,%eax
80102c0e:	83 c8 40             	or     $0x40,%eax
80102c11:	a3 7c b6 10 80       	mov    %eax,0x8010b67c
    return 0;
80102c16:	b8 00 00 00 00       	mov    $0x0,%eax
80102c1b:	e9 f3 00 00 00       	jmp    80102d13 <kbdgetc+0x151>
  } else if(data & 0x80){
80102c20:	8b 45 fc             	mov    -0x4(%ebp),%eax
80102c23:	25 80 00 00 00       	and    $0x80,%eax
80102c28:	85 c0                	test   %eax,%eax
80102c2a:	74 45                	je     80102c71 <kbdgetc+0xaf>
    // Key released
    data = (shift & E0ESC ? data : data & 0x7F);
80102c2c:	a1 7c b6 10 80       	mov    0x8010b67c,%eax
80102c31:	83 e0 40             	and    $0x40,%eax
80102c34:	85 c0                	test   %eax,%eax
80102c36:	75 08                	jne    80102c40 <kbdgetc+0x7e>
80102c38:	8b 45 fc             	mov    -0x4(%ebp),%eax
80102c3b:	83 e0 7f             	and    $0x7f,%eax
80102c3e:	eb 03                	jmp    80102c43 <kbdgetc+0x81>
80102c40:	8b 45 fc             	mov    -0x4(%ebp),%eax
80102c43:	89 45 fc             	mov    %eax,-0x4(%ebp)
    shift &= ~(shiftcode[data] | E0ESC);
80102c46:	8b 45 fc             	mov    -0x4(%ebp),%eax
80102c49:	05 20 90 10 80       	add    $0x80109020,%eax
80102c4e:	0f b6 00             	movzbl (%eax),%eax
80102c51:	83 c8 40             	or     $0x40,%eax
80102c54:	0f b6 c0             	movzbl %al,%eax
80102c57:	f7 d0                	not    %eax
80102c59:	89 c2                	mov    %eax,%edx
80102c5b:	a1 7c b6 10 80       	mov    0x8010b67c,%eax
80102c60:	21 d0                	and    %edx,%eax
80102c62:	a3 7c b6 10 80       	mov    %eax,0x8010b67c
    return 0;
80102c67:	b8 00 00 00 00       	mov    $0x0,%eax
80102c6c:	e9 a2 00 00 00       	jmp    80102d13 <kbdgetc+0x151>
  } else if(shift & E0ESC){
80102c71:	a1 7c b6 10 80       	mov    0x8010b67c,%eax
80102c76:	83 e0 40             	and    $0x40,%eax
80102c79:	85 c0                	test   %eax,%eax
80102c7b:	74 14                	je     80102c91 <kbdgetc+0xcf>
    // Last character was an E0 escape; or with 0x80
    data |= 0x80;
80102c7d:	81 4d fc 80 00 00 00 	orl    $0x80,-0x4(%ebp)
    shift &= ~E0ESC;
80102c84:	a1 7c b6 10 80       	mov    0x8010b67c,%eax
80102c89:	83 e0 bf             	and    $0xffffffbf,%eax
80102c8c:	a3 7c b6 10 80       	mov    %eax,0x8010b67c
  }

  shift |= shiftcode[data];
80102c91:	8b 45 fc             	mov    -0x4(%ebp),%eax
80102c94:	05 20 90 10 80       	add    $0x80109020,%eax
80102c99:	0f b6 00             	movzbl (%eax),%eax
80102c9c:	0f b6 d0             	movzbl %al,%edx
80102c9f:	a1 7c b6 10 80       	mov    0x8010b67c,%eax
80102ca4:	09 d0                	or     %edx,%eax
80102ca6:	a3 7c b6 10 80       	mov    %eax,0x8010b67c
  shift ^= togglecode[data];
80102cab:	8b 45 fc             	mov    -0x4(%ebp),%eax
80102cae:	05 20 91 10 80       	add    $0x80109120,%eax
80102cb3:	0f b6 00             	movzbl (%eax),%eax
80102cb6:	0f b6 d0             	movzbl %al,%edx
80102cb9:	a1 7c b6 10 80       	mov    0x8010b67c,%eax
80102cbe:	31 d0                	xor    %edx,%eax
80102cc0:	a3 7c b6 10 80       	mov    %eax,0x8010b67c
  c = charcode[shift & (CTL | SHIFT)][data];
80102cc5:	a1 7c b6 10 80       	mov    0x8010b67c,%eax
80102cca:	83 e0 03             	and    $0x3,%eax
80102ccd:	8b 14 85 20 95 10 80 	mov    -0x7fef6ae0(,%eax,4),%edx
80102cd4:	8b 45 fc             	mov    -0x4(%ebp),%eax
80102cd7:	01 d0                	add    %edx,%eax
80102cd9:	0f b6 00             	movzbl (%eax),%eax
80102cdc:	0f b6 c0             	movzbl %al,%eax
80102cdf:	89 45 f8             	mov    %eax,-0x8(%ebp)
  if(shift & CAPSLOCK){
80102ce2:	a1 7c b6 10 80       	mov    0x8010b67c,%eax
80102ce7:	83 e0 08             	and    $0x8,%eax
80102cea:	85 c0                	test   %eax,%eax
80102cec:	74 22                	je     80102d10 <kbdgetc+0x14e>
    if('a' <= c && c <= 'z')
80102cee:	83 7d f8 60          	cmpl   $0x60,-0x8(%ebp)
80102cf2:	76 0c                	jbe    80102d00 <kbdgetc+0x13e>
80102cf4:	83 7d f8 7a          	cmpl   $0x7a,-0x8(%ebp)
80102cf8:	77 06                	ja     80102d00 <kbdgetc+0x13e>
      c += 'A' - 'a';
80102cfa:	83 6d f8 20          	subl   $0x20,-0x8(%ebp)
80102cfe:	eb 10                	jmp    80102d10 <kbdgetc+0x14e>
    else if('A' <= c && c <= 'Z')
80102d00:	83 7d f8 40          	cmpl   $0x40,-0x8(%ebp)
80102d04:	76 0a                	jbe    80102d10 <kbdgetc+0x14e>
80102d06:	83 7d f8 5a          	cmpl   $0x5a,-0x8(%ebp)
80102d0a:	77 04                	ja     80102d10 <kbdgetc+0x14e>
      c += 'a' - 'A';
80102d0c:	83 45 f8 20          	addl   $0x20,-0x8(%ebp)
  }
  return c;
80102d10:	8b 45 f8             	mov    -0x8(%ebp),%eax
}
80102d13:	c9                   	leave  
80102d14:	c3                   	ret    

80102d15 <kbdintr>:

void
kbdintr(void)
{
80102d15:	55                   	push   %ebp
80102d16:	89 e5                	mov    %esp,%ebp
80102d18:	83 ec 18             	sub    $0x18,%esp
  consoleintr(kbdgetc);
80102d1b:	c7 04 24 c2 2b 10 80 	movl   $0x80102bc2,(%esp)
80102d22:	e8 8f da ff ff       	call   801007b6 <consoleintr>
}
80102d27:	c9                   	leave  
80102d28:	c3                   	ret    
80102d29:	66 90                	xchg   %ax,%ax
80102d2b:	90                   	nop

80102d2c <outb>:
               "memory", "cc");
}

static inline void
outb(ushort port, uchar data)
{
80102d2c:	55                   	push   %ebp
80102d2d:	89 e5                	mov    %esp,%ebp
80102d2f:	83 ec 08             	sub    $0x8,%esp
80102d32:	8b 55 08             	mov    0x8(%ebp),%edx
80102d35:	8b 45 0c             	mov    0xc(%ebp),%eax
80102d38:	66 89 55 fc          	mov    %dx,-0x4(%ebp)
80102d3c:	88 45 f8             	mov    %al,-0x8(%ebp)
  asm volatile("out %0,%1" : : "a" (data), "d" (port));
80102d3f:	0f b6 45 f8          	movzbl -0x8(%ebp),%eax
80102d43:	0f b7 55 fc          	movzwl -0x4(%ebp),%edx
80102d47:	ee                   	out    %al,(%dx)
}
80102d48:	c9                   	leave  
80102d49:	c3                   	ret    

80102d4a <readeflags>:
  asm volatile("ltr %0" : : "r" (sel));
}

static inline uint
readeflags(void)
{
80102d4a:	55                   	push   %ebp
80102d4b:	89 e5                	mov    %esp,%ebp
80102d4d:	53                   	push   %ebx
80102d4e:	83 ec 10             	sub    $0x10,%esp
  uint eflags;
  asm volatile("pushfl; popl %0" : "=r" (eflags));
80102d51:	9c                   	pushf  
80102d52:	5b                   	pop    %ebx
80102d53:	89 5d f8             	mov    %ebx,-0x8(%ebp)
  return eflags;
80102d56:	8b 45 f8             	mov    -0x8(%ebp),%eax
}
80102d59:	83 c4 10             	add    $0x10,%esp
80102d5c:	5b                   	pop    %ebx
80102d5d:	5d                   	pop    %ebp
80102d5e:	c3                   	ret    

80102d5f <lapicw>:

volatile uint *lapic;  // Initialized in mp.c

static void
lapicw(int index, int value)
{
80102d5f:	55                   	push   %ebp
80102d60:	89 e5                	mov    %esp,%ebp
  lapic[index] = value;
80102d62:	a1 bc f8 10 80       	mov    0x8010f8bc,%eax
80102d67:	8b 55 08             	mov    0x8(%ebp),%edx
80102d6a:	c1 e2 02             	shl    $0x2,%edx
80102d6d:	01 c2                	add    %eax,%edx
80102d6f:	8b 45 0c             	mov    0xc(%ebp),%eax
80102d72:	89 02                	mov    %eax,(%edx)
  lapic[ID];  // wait for write to finish, by reading
80102d74:	a1 bc f8 10 80       	mov    0x8010f8bc,%eax
80102d79:	83 c0 20             	add    $0x20,%eax
80102d7c:	8b 00                	mov    (%eax),%eax
}
80102d7e:	5d                   	pop    %ebp
80102d7f:	c3                   	ret    

80102d80 <lapicinit>:
//PAGEBREAK!

void
lapicinit(int c)
{
80102d80:	55                   	push   %ebp
80102d81:	89 e5                	mov    %esp,%ebp
80102d83:	83 ec 08             	sub    $0x8,%esp
  if(!lapic) 
80102d86:	a1 bc f8 10 80       	mov    0x8010f8bc,%eax
80102d8b:	85 c0                	test   %eax,%eax
80102d8d:	0f 84 47 01 00 00    	je     80102eda <lapicinit+0x15a>
    return;

  // Enable local APIC; set spurious interrupt vector.
  lapicw(SVR, ENABLE | (T_IRQ0 + IRQ_SPURIOUS));
80102d93:	c7 44 24 04 3f 01 00 	movl   $0x13f,0x4(%esp)
80102d9a:	00 
80102d9b:	c7 04 24 3c 00 00 00 	movl   $0x3c,(%esp)
80102da2:	e8 b8 ff ff ff       	call   80102d5f <lapicw>

  // The timer repeatedly counts down at bus frequency
  // from lapic[TICR] and then issues an interrupt.  
  // If xv6 cared more about precise timekeeping,
  // TICR would be calibrated using an external time source.
  lapicw(TDCR, X1);
80102da7:	c7 44 24 04 0b 00 00 	movl   $0xb,0x4(%esp)
80102dae:	00 
80102daf:	c7 04 24 f8 00 00 00 	movl   $0xf8,(%esp)
80102db6:	e8 a4 ff ff ff       	call   80102d5f <lapicw>
  lapicw(TIMER, PERIODIC | (T_IRQ0 + IRQ_TIMER));
80102dbb:	c7 44 24 04 20 00 02 	movl   $0x20020,0x4(%esp)
80102dc2:	00 
80102dc3:	c7 04 24 c8 00 00 00 	movl   $0xc8,(%esp)
80102dca:	e8 90 ff ff ff       	call   80102d5f <lapicw>
  lapicw(TICR, 10000000); 
80102dcf:	c7 44 24 04 80 96 98 	movl   $0x989680,0x4(%esp)
80102dd6:	00 
80102dd7:	c7 04 24 e0 00 00 00 	movl   $0xe0,(%esp)
80102dde:	e8 7c ff ff ff       	call   80102d5f <lapicw>

  // Disable logical interrupt lines.
  lapicw(LINT0, MASKED);
80102de3:	c7 44 24 04 00 00 01 	movl   $0x10000,0x4(%esp)
80102dea:	00 
80102deb:	c7 04 24 d4 00 00 00 	movl   $0xd4,(%esp)
80102df2:	e8 68 ff ff ff       	call   80102d5f <lapicw>
  lapicw(LINT1, MASKED);
80102df7:	c7 44 24 04 00 00 01 	movl   $0x10000,0x4(%esp)
80102dfe:	00 
80102dff:	c7 04 24 d8 00 00 00 	movl   $0xd8,(%esp)
80102e06:	e8 54 ff ff ff       	call   80102d5f <lapicw>

  // Disable performance counter overflow interrupts
  // on machines that provide that interrupt entry.
  if(((lapic[VER]>>16) & 0xFF) >= 4)
80102e0b:	a1 bc f8 10 80       	mov    0x8010f8bc,%eax
80102e10:	83 c0 30             	add    $0x30,%eax
80102e13:	8b 00                	mov    (%eax),%eax
80102e15:	c1 e8 10             	shr    $0x10,%eax
80102e18:	25 ff 00 00 00       	and    $0xff,%eax
80102e1d:	83 f8 03             	cmp    $0x3,%eax
80102e20:	76 14                	jbe    80102e36 <lapicinit+0xb6>
    lapicw(PCINT, MASKED);
80102e22:	c7 44 24 04 00 00 01 	movl   $0x10000,0x4(%esp)
80102e29:	00 
80102e2a:	c7 04 24 d0 00 00 00 	movl   $0xd0,(%esp)
80102e31:	e8 29 ff ff ff       	call   80102d5f <lapicw>

  // Map error interrupt to IRQ_ERROR.
  lapicw(ERROR, T_IRQ0 + IRQ_ERROR);
80102e36:	c7 44 24 04 33 00 00 	movl   $0x33,0x4(%esp)
80102e3d:	00 
80102e3e:	c7 04 24 dc 00 00 00 	movl   $0xdc,(%esp)
80102e45:	e8 15 ff ff ff       	call   80102d5f <lapicw>

  // Clear error status register (requires back-to-back writes).
  lapicw(ESR, 0);
80102e4a:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
80102e51:	00 
80102e52:	c7 04 24 a0 00 00 00 	movl   $0xa0,(%esp)
80102e59:	e8 01 ff ff ff       	call   80102d5f <lapicw>
  lapicw(ESR, 0);
80102e5e:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
80102e65:	00 
80102e66:	c7 04 24 a0 00 00 00 	movl   $0xa0,(%esp)
80102e6d:	e8 ed fe ff ff       	call   80102d5f <lapicw>

  // Ack any outstanding interrupts.
  lapicw(EOI, 0);
80102e72:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
80102e79:	00 
80102e7a:	c7 04 24 2c 00 00 00 	movl   $0x2c,(%esp)
80102e81:	e8 d9 fe ff ff       	call   80102d5f <lapicw>

  // Send an Init Level De-Assert to synchronise arbitration ID's.
  lapicw(ICRHI, 0);
80102e86:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
80102e8d:	00 
80102e8e:	c7 04 24 c4 00 00 00 	movl   $0xc4,(%esp)
80102e95:	e8 c5 fe ff ff       	call   80102d5f <lapicw>
  lapicw(ICRLO, BCAST | INIT | LEVEL);
80102e9a:	c7 44 24 04 00 85 08 	movl   $0x88500,0x4(%esp)
80102ea1:	00 
80102ea2:	c7 04 24 c0 00 00 00 	movl   $0xc0,(%esp)
80102ea9:	e8 b1 fe ff ff       	call   80102d5f <lapicw>
  while(lapic[ICRLO] & DELIVS)
80102eae:	90                   	nop
80102eaf:	a1 bc f8 10 80       	mov    0x8010f8bc,%eax
80102eb4:	05 00 03 00 00       	add    $0x300,%eax
80102eb9:	8b 00                	mov    (%eax),%eax
80102ebb:	25 00 10 00 00       	and    $0x1000,%eax
80102ec0:	85 c0                	test   %eax,%eax
80102ec2:	75 eb                	jne    80102eaf <lapicinit+0x12f>
    ;

  // Enable interrupts on the APIC (but not on the processor).
  lapicw(TPR, 0);
80102ec4:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
80102ecb:	00 
80102ecc:	c7 04 24 20 00 00 00 	movl   $0x20,(%esp)
80102ed3:	e8 87 fe ff ff       	call   80102d5f <lapicw>
80102ed8:	eb 01                	jmp    80102edb <lapicinit+0x15b>

void
lapicinit(int c)
{
  if(!lapic) 
    return;
80102eda:	90                   	nop
  while(lapic[ICRLO] & DELIVS)
    ;

  // Enable interrupts on the APIC (but not on the processor).
  lapicw(TPR, 0);
}
80102edb:	c9                   	leave  
80102edc:	c3                   	ret    

80102edd <cpunum>:

int
cpunum(void)
{
80102edd:	55                   	push   %ebp
80102ede:	89 e5                	mov    %esp,%ebp
80102ee0:	83 ec 18             	sub    $0x18,%esp
  // Cannot call cpu when interrupts are enabled:
  // result not guaranteed to last long enough to be used!
  // Would prefer to panic but even printing is chancy here:
  // almost everything, including cprintf and panic, calls cpu,
  // often indirectly through acquire and release.
  if(readeflags()&FL_IF){
80102ee3:	e8 62 fe ff ff       	call   80102d4a <readeflags>
80102ee8:	25 00 02 00 00       	and    $0x200,%eax
80102eed:	85 c0                	test   %eax,%eax
80102eef:	74 29                	je     80102f1a <cpunum+0x3d>
    static int n;
    if(n++ == 0)
80102ef1:	a1 80 b6 10 80       	mov    0x8010b680,%eax
80102ef6:	85 c0                	test   %eax,%eax
80102ef8:	0f 94 c2             	sete   %dl
80102efb:	83 c0 01             	add    $0x1,%eax
80102efe:	a3 80 b6 10 80       	mov    %eax,0x8010b680
80102f03:	84 d2                	test   %dl,%dl
80102f05:	74 13                	je     80102f1a <cpunum+0x3d>
      cprintf("cpu called from %x with interrupts enabled\n",
80102f07:	8b 45 04             	mov    0x4(%ebp),%eax
80102f0a:	89 44 24 04          	mov    %eax,0x4(%esp)
80102f0e:	c7 04 24 dc 88 10 80 	movl   $0x801088dc,(%esp)
80102f15:	e8 90 d4 ff ff       	call   801003aa <cprintf>
        __builtin_return_address(0));
  }

  if(lapic)
80102f1a:	a1 bc f8 10 80       	mov    0x8010f8bc,%eax
80102f1f:	85 c0                	test   %eax,%eax
80102f21:	74 0f                	je     80102f32 <cpunum+0x55>
    return lapic[ID]>>24;
80102f23:	a1 bc f8 10 80       	mov    0x8010f8bc,%eax
80102f28:	83 c0 20             	add    $0x20,%eax
80102f2b:	8b 00                	mov    (%eax),%eax
80102f2d:	c1 e8 18             	shr    $0x18,%eax
80102f30:	eb 05                	jmp    80102f37 <cpunum+0x5a>
  return 0;
80102f32:	b8 00 00 00 00       	mov    $0x0,%eax
}
80102f37:	c9                   	leave  
80102f38:	c3                   	ret    

80102f39 <lapiceoi>:

// Acknowledge interrupt.
void
lapiceoi(void)
{
80102f39:	55                   	push   %ebp
80102f3a:	89 e5                	mov    %esp,%ebp
80102f3c:	83 ec 08             	sub    $0x8,%esp
  if(lapic)
80102f3f:	a1 bc f8 10 80       	mov    0x8010f8bc,%eax
80102f44:	85 c0                	test   %eax,%eax
80102f46:	74 14                	je     80102f5c <lapiceoi+0x23>
    lapicw(EOI, 0);
80102f48:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
80102f4f:	00 
80102f50:	c7 04 24 2c 00 00 00 	movl   $0x2c,(%esp)
80102f57:	e8 03 fe ff ff       	call   80102d5f <lapicw>
}
80102f5c:	c9                   	leave  
80102f5d:	c3                   	ret    

80102f5e <microdelay>:

// Spin for a given number of microseconds.
// On real hardware would want to tune this dynamically.
void
microdelay(int us)
{
80102f5e:	55                   	push   %ebp
80102f5f:	89 e5                	mov    %esp,%ebp
}
80102f61:	5d                   	pop    %ebp
80102f62:	c3                   	ret    

80102f63 <lapicstartap>:

// Start additional processor running entry code at addr.
// See Appendix B of MultiProcessor Specification.
void
lapicstartap(uchar apicid, uint addr)
{
80102f63:	55                   	push   %ebp
80102f64:	89 e5                	mov    %esp,%ebp
80102f66:	83 ec 1c             	sub    $0x1c,%esp
80102f69:	8b 45 08             	mov    0x8(%ebp),%eax
80102f6c:	88 45 ec             	mov    %al,-0x14(%ebp)
  ushort *wrv;
  
  // "The BSP must initialize CMOS shutdown code to 0AH
  // and the warm reset vector (DWORD based at 40:67) to point at
  // the AP startup code prior to the [universal startup algorithm]."
  outb(IO_RTC, 0xF);  // offset 0xF is shutdown code
80102f6f:	c7 44 24 04 0f 00 00 	movl   $0xf,0x4(%esp)
80102f76:	00 
80102f77:	c7 04 24 70 00 00 00 	movl   $0x70,(%esp)
80102f7e:	e8 a9 fd ff ff       	call   80102d2c <outb>
  outb(IO_RTC+1, 0x0A);
80102f83:	c7 44 24 04 0a 00 00 	movl   $0xa,0x4(%esp)
80102f8a:	00 
80102f8b:	c7 04 24 71 00 00 00 	movl   $0x71,(%esp)
80102f92:	e8 95 fd ff ff       	call   80102d2c <outb>
  wrv = (ushort*)P2V((0x40<<4 | 0x67));  // Warm reset vector
80102f97:	c7 45 f8 67 04 00 80 	movl   $0x80000467,-0x8(%ebp)
  wrv[0] = 0;
80102f9e:	8b 45 f8             	mov    -0x8(%ebp),%eax
80102fa1:	66 c7 00 00 00       	movw   $0x0,(%eax)
  wrv[1] = addr >> 4;
80102fa6:	8b 45 f8             	mov    -0x8(%ebp),%eax
80102fa9:	8d 50 02             	lea    0x2(%eax),%edx
80102fac:	8b 45 0c             	mov    0xc(%ebp),%eax
80102faf:	c1 e8 04             	shr    $0x4,%eax
80102fb2:	66 89 02             	mov    %ax,(%edx)

  // "Universal startup algorithm."
  // Send INIT (level-triggered) interrupt to reset other CPU.
  lapicw(ICRHI, apicid<<24);
80102fb5:	0f b6 45 ec          	movzbl -0x14(%ebp),%eax
80102fb9:	c1 e0 18             	shl    $0x18,%eax
80102fbc:	89 44 24 04          	mov    %eax,0x4(%esp)
80102fc0:	c7 04 24 c4 00 00 00 	movl   $0xc4,(%esp)
80102fc7:	e8 93 fd ff ff       	call   80102d5f <lapicw>
  lapicw(ICRLO, INIT | LEVEL | ASSERT);
80102fcc:	c7 44 24 04 00 c5 00 	movl   $0xc500,0x4(%esp)
80102fd3:	00 
80102fd4:	c7 04 24 c0 00 00 00 	movl   $0xc0,(%esp)
80102fdb:	e8 7f fd ff ff       	call   80102d5f <lapicw>
  microdelay(200);
80102fe0:	c7 04 24 c8 00 00 00 	movl   $0xc8,(%esp)
80102fe7:	e8 72 ff ff ff       	call   80102f5e <microdelay>
  lapicw(ICRLO, INIT | LEVEL);
80102fec:	c7 44 24 04 00 85 00 	movl   $0x8500,0x4(%esp)
80102ff3:	00 
80102ff4:	c7 04 24 c0 00 00 00 	movl   $0xc0,(%esp)
80102ffb:	e8 5f fd ff ff       	call   80102d5f <lapicw>
  microdelay(100);    // should be 10ms, but too slow in Bochs!
80103000:	c7 04 24 64 00 00 00 	movl   $0x64,(%esp)
80103007:	e8 52 ff ff ff       	call   80102f5e <microdelay>
  // Send startup IPI (twice!) to enter code.
  // Regular hardware is supposed to only accept a STARTUP
  // when it is in the halted state due to an INIT.  So the second
  // should be ignored, but it is part of the official Intel algorithm.
  // Bochs complains about the second one.  Too bad for Bochs.
  for(i = 0; i < 2; i++){
8010300c:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
80103013:	eb 40                	jmp    80103055 <lapicstartap+0xf2>
    lapicw(ICRHI, apicid<<24);
80103015:	0f b6 45 ec          	movzbl -0x14(%ebp),%eax
80103019:	c1 e0 18             	shl    $0x18,%eax
8010301c:	89 44 24 04          	mov    %eax,0x4(%esp)
80103020:	c7 04 24 c4 00 00 00 	movl   $0xc4,(%esp)
80103027:	e8 33 fd ff ff       	call   80102d5f <lapicw>
    lapicw(ICRLO, STARTUP | (addr>>12));
8010302c:	8b 45 0c             	mov    0xc(%ebp),%eax
8010302f:	c1 e8 0c             	shr    $0xc,%eax
80103032:	80 cc 06             	or     $0x6,%ah
80103035:	89 44 24 04          	mov    %eax,0x4(%esp)
80103039:	c7 04 24 c0 00 00 00 	movl   $0xc0,(%esp)
80103040:	e8 1a fd ff ff       	call   80102d5f <lapicw>
    microdelay(200);
80103045:	c7 04 24 c8 00 00 00 	movl   $0xc8,(%esp)
8010304c:	e8 0d ff ff ff       	call   80102f5e <microdelay>
  // Send startup IPI (twice!) to enter code.
  // Regular hardware is supposed to only accept a STARTUP
  // when it is in the halted state due to an INIT.  So the second
  // should be ignored, but it is part of the official Intel algorithm.
  // Bochs complains about the second one.  Too bad for Bochs.
  for(i = 0; i < 2; i++){
80103051:	83 45 fc 01          	addl   $0x1,-0x4(%ebp)
80103055:	83 7d fc 01          	cmpl   $0x1,-0x4(%ebp)
80103059:	7e ba                	jle    80103015 <lapicstartap+0xb2>
    lapicw(ICRHI, apicid<<24);
    lapicw(ICRLO, STARTUP | (addr>>12));
    microdelay(200);
  }
}
8010305b:	c9                   	leave  
8010305c:	c3                   	ret    
8010305d:	66 90                	xchg   %ax,%ax
8010305f:	90                   	nop

80103060 <initlog>:

static void recover_from_log(void);

void
initlog(void)
{
80103060:	55                   	push   %ebp
80103061:	89 e5                	mov    %esp,%ebp
80103063:	83 ec 28             	sub    $0x28,%esp
  if (sizeof(struct logheader) >= BSIZE)
    panic("initlog: too big logheader");

  struct superblock sb;
  initlock(&log.lock, "log");
80103066:	c7 44 24 04 08 89 10 	movl   $0x80108908,0x4(%esp)
8010306d:	80 
8010306e:	c7 04 24 c0 f8 10 80 	movl   $0x8010f8c0,(%esp)
80103075:	e8 7c 1f 00 00       	call   80104ff6 <initlock>
  readsb(ROOTDEV, &sb);
8010307a:	8d 45 e8             	lea    -0x18(%ebp),%eax
8010307d:	89 44 24 04          	mov    %eax,0x4(%esp)
80103081:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
80103088:	e8 87 e2 ff ff       	call   80101314 <readsb>
  log.start = sb.size - sb.nlog;
8010308d:	8b 55 e8             	mov    -0x18(%ebp),%edx
80103090:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103093:	89 d1                	mov    %edx,%ecx
80103095:	29 c1                	sub    %eax,%ecx
80103097:	89 c8                	mov    %ecx,%eax
80103099:	a3 f4 f8 10 80       	mov    %eax,0x8010f8f4
  log.size = sb.nlog;
8010309e:	8b 45 f4             	mov    -0xc(%ebp),%eax
801030a1:	a3 f8 f8 10 80       	mov    %eax,0x8010f8f8
  log.dev = ROOTDEV;
801030a6:	c7 05 00 f9 10 80 01 	movl   $0x1,0x8010f900
801030ad:	00 00 00 
  recover_from_log();
801030b0:	e8 9a 01 00 00       	call   8010324f <recover_from_log>
}
801030b5:	c9                   	leave  
801030b6:	c3                   	ret    

801030b7 <install_trans>:

// Copy committed blocks from log to their home location
static void 
install_trans(void)
{
801030b7:	55                   	push   %ebp
801030b8:	89 e5                	mov    %esp,%ebp
801030ba:	83 ec 28             	sub    $0x28,%esp
  int tail;

  for (tail = 0; tail < log.lh.n; tail++) {
801030bd:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
801030c4:	e9 8c 00 00 00       	jmp    80103155 <install_trans+0x9e>
    struct buf *lbuf = bread(log.dev, log.start+tail+1); // read log block
801030c9:	8b 15 f4 f8 10 80    	mov    0x8010f8f4,%edx
801030cf:	8b 45 f4             	mov    -0xc(%ebp),%eax
801030d2:	01 d0                	add    %edx,%eax
801030d4:	83 c0 01             	add    $0x1,%eax
801030d7:	89 c2                	mov    %eax,%edx
801030d9:	a1 00 f9 10 80       	mov    0x8010f900,%eax
801030de:	89 54 24 04          	mov    %edx,0x4(%esp)
801030e2:	89 04 24             	mov    %eax,(%esp)
801030e5:	e8 bc d0 ff ff       	call   801001a6 <bread>
801030ea:	89 45 f0             	mov    %eax,-0x10(%ebp)
    struct buf *dbuf = bread(log.dev, log.lh.sector[tail]); // read dst
801030ed:	8b 45 f4             	mov    -0xc(%ebp),%eax
801030f0:	83 c0 10             	add    $0x10,%eax
801030f3:	8b 04 85 c8 f8 10 80 	mov    -0x7fef0738(,%eax,4),%eax
801030fa:	89 c2                	mov    %eax,%edx
801030fc:	a1 00 f9 10 80       	mov    0x8010f900,%eax
80103101:	89 54 24 04          	mov    %edx,0x4(%esp)
80103105:	89 04 24             	mov    %eax,(%esp)
80103108:	e8 99 d0 ff ff       	call   801001a6 <bread>
8010310d:	89 45 ec             	mov    %eax,-0x14(%ebp)
    memmove(dbuf->data, lbuf->data, BSIZE);  // copy block to dst
80103110:	8b 45 f0             	mov    -0x10(%ebp),%eax
80103113:	8d 50 18             	lea    0x18(%eax),%edx
80103116:	8b 45 ec             	mov    -0x14(%ebp),%eax
80103119:	83 c0 18             	add    $0x18,%eax
8010311c:	c7 44 24 08 00 02 00 	movl   $0x200,0x8(%esp)
80103123:	00 
80103124:	89 54 24 04          	mov    %edx,0x4(%esp)
80103128:	89 04 24             	mov    %eax,(%esp)
8010312b:	e8 15 22 00 00       	call   80105345 <memmove>
    bwrite(dbuf);  // write dst to disk
80103130:	8b 45 ec             	mov    -0x14(%ebp),%eax
80103133:	89 04 24             	mov    %eax,(%esp)
80103136:	e8 a2 d0 ff ff       	call   801001dd <bwrite>
    brelse(lbuf); 
8010313b:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010313e:	89 04 24             	mov    %eax,(%esp)
80103141:	e8 d1 d0 ff ff       	call   80100217 <brelse>
    brelse(dbuf);
80103146:	8b 45 ec             	mov    -0x14(%ebp),%eax
80103149:	89 04 24             	mov    %eax,(%esp)
8010314c:	e8 c6 d0 ff ff       	call   80100217 <brelse>
static void 
install_trans(void)
{
  int tail;

  for (tail = 0; tail < log.lh.n; tail++) {
80103151:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
80103155:	a1 04 f9 10 80       	mov    0x8010f904,%eax
8010315a:	3b 45 f4             	cmp    -0xc(%ebp),%eax
8010315d:	0f 8f 66 ff ff ff    	jg     801030c9 <install_trans+0x12>
    memmove(dbuf->data, lbuf->data, BSIZE);  // copy block to dst
    bwrite(dbuf);  // write dst to disk
    brelse(lbuf); 
    brelse(dbuf);
  }
}
80103163:	c9                   	leave  
80103164:	c3                   	ret    

80103165 <read_head>:

// Read the log header from disk into the in-memory log header
static void
read_head(void)
{
80103165:	55                   	push   %ebp
80103166:	89 e5                	mov    %esp,%ebp
80103168:	83 ec 28             	sub    $0x28,%esp
  struct buf *buf = bread(log.dev, log.start);
8010316b:	a1 f4 f8 10 80       	mov    0x8010f8f4,%eax
80103170:	89 c2                	mov    %eax,%edx
80103172:	a1 00 f9 10 80       	mov    0x8010f900,%eax
80103177:	89 54 24 04          	mov    %edx,0x4(%esp)
8010317b:	89 04 24             	mov    %eax,(%esp)
8010317e:	e8 23 d0 ff ff       	call   801001a6 <bread>
80103183:	89 45 f0             	mov    %eax,-0x10(%ebp)
  struct logheader *lh = (struct logheader *) (buf->data);
80103186:	8b 45 f0             	mov    -0x10(%ebp),%eax
80103189:	83 c0 18             	add    $0x18,%eax
8010318c:	89 45 ec             	mov    %eax,-0x14(%ebp)
  int i;
  log.lh.n = lh->n;
8010318f:	8b 45 ec             	mov    -0x14(%ebp),%eax
80103192:	8b 00                	mov    (%eax),%eax
80103194:	a3 04 f9 10 80       	mov    %eax,0x8010f904
  for (i = 0; i < log.lh.n; i++) {
80103199:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
801031a0:	eb 1b                	jmp    801031bd <read_head+0x58>
    log.lh.sector[i] = lh->sector[i];
801031a2:	8b 45 ec             	mov    -0x14(%ebp),%eax
801031a5:	8b 55 f4             	mov    -0xc(%ebp),%edx
801031a8:	8b 44 90 04          	mov    0x4(%eax,%edx,4),%eax
801031ac:	8b 55 f4             	mov    -0xc(%ebp),%edx
801031af:	83 c2 10             	add    $0x10,%edx
801031b2:	89 04 95 c8 f8 10 80 	mov    %eax,-0x7fef0738(,%edx,4)
{
  struct buf *buf = bread(log.dev, log.start);
  struct logheader *lh = (struct logheader *) (buf->data);
  int i;
  log.lh.n = lh->n;
  for (i = 0; i < log.lh.n; i++) {
801031b9:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
801031bd:	a1 04 f9 10 80       	mov    0x8010f904,%eax
801031c2:	3b 45 f4             	cmp    -0xc(%ebp),%eax
801031c5:	7f db                	jg     801031a2 <read_head+0x3d>
    log.lh.sector[i] = lh->sector[i];
  }
  brelse(buf);
801031c7:	8b 45 f0             	mov    -0x10(%ebp),%eax
801031ca:	89 04 24             	mov    %eax,(%esp)
801031cd:	e8 45 d0 ff ff       	call   80100217 <brelse>
}
801031d2:	c9                   	leave  
801031d3:	c3                   	ret    

801031d4 <write_head>:
// Write in-memory log header to disk.
// This is the true point at which the
// current transaction commits.
static void
write_head(void)
{
801031d4:	55                   	push   %ebp
801031d5:	89 e5                	mov    %esp,%ebp
801031d7:	83 ec 28             	sub    $0x28,%esp
  struct buf *buf = bread(log.dev, log.start);
801031da:	a1 f4 f8 10 80       	mov    0x8010f8f4,%eax
801031df:	89 c2                	mov    %eax,%edx
801031e1:	a1 00 f9 10 80       	mov    0x8010f900,%eax
801031e6:	89 54 24 04          	mov    %edx,0x4(%esp)
801031ea:	89 04 24             	mov    %eax,(%esp)
801031ed:	e8 b4 cf ff ff       	call   801001a6 <bread>
801031f2:	89 45 f0             	mov    %eax,-0x10(%ebp)
  struct logheader *hb = (struct logheader *) (buf->data);
801031f5:	8b 45 f0             	mov    -0x10(%ebp),%eax
801031f8:	83 c0 18             	add    $0x18,%eax
801031fb:	89 45 ec             	mov    %eax,-0x14(%ebp)
  int i;
  hb->n = log.lh.n;
801031fe:	8b 15 04 f9 10 80    	mov    0x8010f904,%edx
80103204:	8b 45 ec             	mov    -0x14(%ebp),%eax
80103207:	89 10                	mov    %edx,(%eax)
  for (i = 0; i < log.lh.n; i++) {
80103209:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
80103210:	eb 1b                	jmp    8010322d <write_head+0x59>
    hb->sector[i] = log.lh.sector[i];
80103212:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103215:	83 c0 10             	add    $0x10,%eax
80103218:	8b 0c 85 c8 f8 10 80 	mov    -0x7fef0738(,%eax,4),%ecx
8010321f:	8b 45 ec             	mov    -0x14(%ebp),%eax
80103222:	8b 55 f4             	mov    -0xc(%ebp),%edx
80103225:	89 4c 90 04          	mov    %ecx,0x4(%eax,%edx,4)
{
  struct buf *buf = bread(log.dev, log.start);
  struct logheader *hb = (struct logheader *) (buf->data);
  int i;
  hb->n = log.lh.n;
  for (i = 0; i < log.lh.n; i++) {
80103229:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
8010322d:	a1 04 f9 10 80       	mov    0x8010f904,%eax
80103232:	3b 45 f4             	cmp    -0xc(%ebp),%eax
80103235:	7f db                	jg     80103212 <write_head+0x3e>
    hb->sector[i] = log.lh.sector[i];
  }
  bwrite(buf);
80103237:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010323a:	89 04 24             	mov    %eax,(%esp)
8010323d:	e8 9b cf ff ff       	call   801001dd <bwrite>
  brelse(buf);
80103242:	8b 45 f0             	mov    -0x10(%ebp),%eax
80103245:	89 04 24             	mov    %eax,(%esp)
80103248:	e8 ca cf ff ff       	call   80100217 <brelse>
}
8010324d:	c9                   	leave  
8010324e:	c3                   	ret    

8010324f <recover_from_log>:

static void
recover_from_log(void)
{
8010324f:	55                   	push   %ebp
80103250:	89 e5                	mov    %esp,%ebp
80103252:	83 ec 08             	sub    $0x8,%esp
  read_head();      
80103255:	e8 0b ff ff ff       	call   80103165 <read_head>
  install_trans(); // if committed, copy from log to disk
8010325a:	e8 58 fe ff ff       	call   801030b7 <install_trans>
  log.lh.n = 0;
8010325f:	c7 05 04 f9 10 80 00 	movl   $0x0,0x8010f904
80103266:	00 00 00 
  write_head(); // clear the log
80103269:	e8 66 ff ff ff       	call   801031d4 <write_head>
}
8010326e:	c9                   	leave  
8010326f:	c3                   	ret    

80103270 <begin_trans>:

void
begin_trans(void)
{
80103270:	55                   	push   %ebp
80103271:	89 e5                	mov    %esp,%ebp
80103273:	83 ec 18             	sub    $0x18,%esp
  acquire(&log.lock);
80103276:	c7 04 24 c0 f8 10 80 	movl   $0x8010f8c0,(%esp)
8010327d:	e8 95 1d 00 00       	call   80105017 <acquire>
  while (log.busy) {
80103282:	eb 14                	jmp    80103298 <begin_trans+0x28>
    sleep(&log, &log.lock);
80103284:	c7 44 24 04 c0 f8 10 	movl   $0x8010f8c0,0x4(%esp)
8010328b:	80 
8010328c:	c7 04 24 c0 f8 10 80 	movl   $0x8010f8c0,(%esp)
80103293:	e8 aa 17 00 00       	call   80104a42 <sleep>

void
begin_trans(void)
{
  acquire(&log.lock);
  while (log.busy) {
80103298:	a1 fc f8 10 80       	mov    0x8010f8fc,%eax
8010329d:	85 c0                	test   %eax,%eax
8010329f:	75 e3                	jne    80103284 <begin_trans+0x14>
    sleep(&log, &log.lock);
  }
  log.busy = 1;
801032a1:	c7 05 fc f8 10 80 01 	movl   $0x1,0x8010f8fc
801032a8:	00 00 00 
  release(&log.lock);
801032ab:	c7 04 24 c0 f8 10 80 	movl   $0x8010f8c0,(%esp)
801032b2:	e8 c2 1d 00 00       	call   80105079 <release>
}
801032b7:	c9                   	leave  
801032b8:	c3                   	ret    

801032b9 <commit_trans>:

void
commit_trans(void)
{
801032b9:	55                   	push   %ebp
801032ba:	89 e5                	mov    %esp,%ebp
801032bc:	83 ec 18             	sub    $0x18,%esp
  if (log.lh.n > 0) {
801032bf:	a1 04 f9 10 80       	mov    0x8010f904,%eax
801032c4:	85 c0                	test   %eax,%eax
801032c6:	7e 19                	jle    801032e1 <commit_trans+0x28>
    write_head();    // Write header to disk -- the real commit
801032c8:	e8 07 ff ff ff       	call   801031d4 <write_head>
    install_trans(); // Now install writes to home locations
801032cd:	e8 e5 fd ff ff       	call   801030b7 <install_trans>
    log.lh.n = 0; 
801032d2:	c7 05 04 f9 10 80 00 	movl   $0x0,0x8010f904
801032d9:	00 00 00 
    write_head();    // Erase the transaction from the log
801032dc:	e8 f3 fe ff ff       	call   801031d4 <write_head>
  }
  
  acquire(&log.lock);
801032e1:	c7 04 24 c0 f8 10 80 	movl   $0x8010f8c0,(%esp)
801032e8:	e8 2a 1d 00 00       	call   80105017 <acquire>
  log.busy = 0;
801032ed:	c7 05 fc f8 10 80 00 	movl   $0x0,0x8010f8fc
801032f4:	00 00 00 
  wakeup(&log);
801032f7:	c7 04 24 c0 f8 10 80 	movl   $0x8010f8c0,(%esp)
801032fe:	e8 1b 18 00 00       	call   80104b1e <wakeup>
  release(&log.lock);
80103303:	c7 04 24 c0 f8 10 80 	movl   $0x8010f8c0,(%esp)
8010330a:	e8 6a 1d 00 00       	call   80105079 <release>
}
8010330f:	c9                   	leave  
80103310:	c3                   	ret    

80103311 <log_write>:
//   modify bp->data[]
//   log_write(bp)
//   brelse(bp)
void
log_write(struct buf *b)
{
80103311:	55                   	push   %ebp
80103312:	89 e5                	mov    %esp,%ebp
80103314:	83 ec 28             	sub    $0x28,%esp
  int i;

  if (log.lh.n >= LOGSIZE || log.lh.n >= log.size - 1)
80103317:	a1 04 f9 10 80       	mov    0x8010f904,%eax
8010331c:	83 f8 09             	cmp    $0x9,%eax
8010331f:	7f 12                	jg     80103333 <log_write+0x22>
80103321:	a1 04 f9 10 80       	mov    0x8010f904,%eax
80103326:	8b 15 f8 f8 10 80    	mov    0x8010f8f8,%edx
8010332c:	83 ea 01             	sub    $0x1,%edx
8010332f:	39 d0                	cmp    %edx,%eax
80103331:	7c 0c                	jl     8010333f <log_write+0x2e>
    panic("too big a transaction");
80103333:	c7 04 24 0c 89 10 80 	movl   $0x8010890c,(%esp)
8010333a:	e8 07 d2 ff ff       	call   80100546 <panic>
  if (!log.busy)
8010333f:	a1 fc f8 10 80       	mov    0x8010f8fc,%eax
80103344:	85 c0                	test   %eax,%eax
80103346:	75 0c                	jne    80103354 <log_write+0x43>
    panic("write outside of trans");
80103348:	c7 04 24 22 89 10 80 	movl   $0x80108922,(%esp)
8010334f:	e8 f2 d1 ff ff       	call   80100546 <panic>

  for (i = 0; i < log.lh.n; i++) {
80103354:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
8010335b:	eb 1d                	jmp    8010337a <log_write+0x69>
    if (log.lh.sector[i] == b->sector)   // log absorbtion?
8010335d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103360:	83 c0 10             	add    $0x10,%eax
80103363:	8b 04 85 c8 f8 10 80 	mov    -0x7fef0738(,%eax,4),%eax
8010336a:	89 c2                	mov    %eax,%edx
8010336c:	8b 45 08             	mov    0x8(%ebp),%eax
8010336f:	8b 40 08             	mov    0x8(%eax),%eax
80103372:	39 c2                	cmp    %eax,%edx
80103374:	74 10                	je     80103386 <log_write+0x75>
  if (log.lh.n >= LOGSIZE || log.lh.n >= log.size - 1)
    panic("too big a transaction");
  if (!log.busy)
    panic("write outside of trans");

  for (i = 0; i < log.lh.n; i++) {
80103376:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
8010337a:	a1 04 f9 10 80       	mov    0x8010f904,%eax
8010337f:	3b 45 f4             	cmp    -0xc(%ebp),%eax
80103382:	7f d9                	jg     8010335d <log_write+0x4c>
80103384:	eb 01                	jmp    80103387 <log_write+0x76>
    if (log.lh.sector[i] == b->sector)   // log absorbtion?
      break;
80103386:	90                   	nop
  }
  log.lh.sector[i] = b->sector;
80103387:	8b 45 08             	mov    0x8(%ebp),%eax
8010338a:	8b 40 08             	mov    0x8(%eax),%eax
8010338d:	8b 55 f4             	mov    -0xc(%ebp),%edx
80103390:	83 c2 10             	add    $0x10,%edx
80103393:	89 04 95 c8 f8 10 80 	mov    %eax,-0x7fef0738(,%edx,4)
  struct buf *lbuf = bread(b->dev, log.start+i+1);
8010339a:	8b 15 f4 f8 10 80    	mov    0x8010f8f4,%edx
801033a0:	8b 45 f4             	mov    -0xc(%ebp),%eax
801033a3:	01 d0                	add    %edx,%eax
801033a5:	83 c0 01             	add    $0x1,%eax
801033a8:	89 c2                	mov    %eax,%edx
801033aa:	8b 45 08             	mov    0x8(%ebp),%eax
801033ad:	8b 40 04             	mov    0x4(%eax),%eax
801033b0:	89 54 24 04          	mov    %edx,0x4(%esp)
801033b4:	89 04 24             	mov    %eax,(%esp)
801033b7:	e8 ea cd ff ff       	call   801001a6 <bread>
801033bc:	89 45 f0             	mov    %eax,-0x10(%ebp)
  memmove(lbuf->data, b->data, BSIZE);
801033bf:	8b 45 08             	mov    0x8(%ebp),%eax
801033c2:	8d 50 18             	lea    0x18(%eax),%edx
801033c5:	8b 45 f0             	mov    -0x10(%ebp),%eax
801033c8:	83 c0 18             	add    $0x18,%eax
801033cb:	c7 44 24 08 00 02 00 	movl   $0x200,0x8(%esp)
801033d2:	00 
801033d3:	89 54 24 04          	mov    %edx,0x4(%esp)
801033d7:	89 04 24             	mov    %eax,(%esp)
801033da:	e8 66 1f 00 00       	call   80105345 <memmove>
  bwrite(lbuf);
801033df:	8b 45 f0             	mov    -0x10(%ebp),%eax
801033e2:	89 04 24             	mov    %eax,(%esp)
801033e5:	e8 f3 cd ff ff       	call   801001dd <bwrite>
  brelse(lbuf);
801033ea:	8b 45 f0             	mov    -0x10(%ebp),%eax
801033ed:	89 04 24             	mov    %eax,(%esp)
801033f0:	e8 22 ce ff ff       	call   80100217 <brelse>
  if (i == log.lh.n)
801033f5:	a1 04 f9 10 80       	mov    0x8010f904,%eax
801033fa:	3b 45 f4             	cmp    -0xc(%ebp),%eax
801033fd:	75 0d                	jne    8010340c <log_write+0xfb>
    log.lh.n++;
801033ff:	a1 04 f9 10 80       	mov    0x8010f904,%eax
80103404:	83 c0 01             	add    $0x1,%eax
80103407:	a3 04 f9 10 80       	mov    %eax,0x8010f904
  b->flags |= B_DIRTY; // XXX prevent eviction
8010340c:	8b 45 08             	mov    0x8(%ebp),%eax
8010340f:	8b 00                	mov    (%eax),%eax
80103411:	89 c2                	mov    %eax,%edx
80103413:	83 ca 04             	or     $0x4,%edx
80103416:	8b 45 08             	mov    0x8(%ebp),%eax
80103419:	89 10                	mov    %edx,(%eax)
}
8010341b:	c9                   	leave  
8010341c:	c3                   	ret    
8010341d:	66 90                	xchg   %ax,%ax
8010341f:	90                   	nop

80103420 <v2p>:
80103420:	55                   	push   %ebp
80103421:	89 e5                	mov    %esp,%ebp
80103423:	8b 45 08             	mov    0x8(%ebp),%eax
80103426:	05 00 00 00 80       	add    $0x80000000,%eax
8010342b:	5d                   	pop    %ebp
8010342c:	c3                   	ret    

8010342d <p2v>:
static inline void *p2v(uint a) { return (void *) ((a) + KERNBASE); }
8010342d:	55                   	push   %ebp
8010342e:	89 e5                	mov    %esp,%ebp
80103430:	8b 45 08             	mov    0x8(%ebp),%eax
80103433:	05 00 00 00 80       	add    $0x80000000,%eax
80103438:	5d                   	pop    %ebp
80103439:	c3                   	ret    

8010343a <xchg>:
  asm volatile("sti");
}

static inline uint
xchg(volatile uint *addr, uint newval)
{
8010343a:	55                   	push   %ebp
8010343b:	89 e5                	mov    %esp,%ebp
8010343d:	53                   	push   %ebx
8010343e:	83 ec 10             	sub    $0x10,%esp
  uint result;
  
  // The + in "+m" denotes a read-modify-write operand.
  asm volatile("lock; xchgl %0, %1" :
               "+m" (*addr), "=a" (result) :
80103441:	8b 55 08             	mov    0x8(%ebp),%edx
xchg(volatile uint *addr, uint newval)
{
  uint result;
  
  // The + in "+m" denotes a read-modify-write operand.
  asm volatile("lock; xchgl %0, %1" :
80103444:	8b 45 0c             	mov    0xc(%ebp),%eax
               "+m" (*addr), "=a" (result) :
80103447:	8b 4d 08             	mov    0x8(%ebp),%ecx
xchg(volatile uint *addr, uint newval)
{
  uint result;
  
  // The + in "+m" denotes a read-modify-write operand.
  asm volatile("lock; xchgl %0, %1" :
8010344a:	89 c3                	mov    %eax,%ebx
8010344c:	89 d8                	mov    %ebx,%eax
8010344e:	f0 87 02             	lock xchg %eax,(%edx)
80103451:	89 c3                	mov    %eax,%ebx
80103453:	89 5d f8             	mov    %ebx,-0x8(%ebp)
               "+m" (*addr), "=a" (result) :
               "1" (newval) :
               "cc");
  return result;
80103456:	8b 45 f8             	mov    -0x8(%ebp),%eax
}
80103459:	83 c4 10             	add    $0x10,%esp
8010345c:	5b                   	pop    %ebx
8010345d:	5d                   	pop    %ebp
8010345e:	c3                   	ret    

8010345f <main>:
// Bootstrap processor starts running C code here.
// Allocate a real stack and switch to it, first
// doing some setup required for memory allocator to work.
int
main(void)
{
8010345f:	55                   	push   %ebp
80103460:	89 e5                	mov    %esp,%ebp
80103462:	83 e4 f0             	and    $0xfffffff0,%esp
80103465:	83 ec 10             	sub    $0x10,%esp
  kinit1(end, P2V(4*1024*1024)); // phys page allocator
80103468:	c7 44 24 04 00 00 40 	movl   $0x80400000,0x4(%esp)
8010346f:	80 
80103470:	c7 04 24 3c 49 11 80 	movl   $0x8011493c,(%esp)
80103477:	e8 a1 f5 ff ff       	call   80102a1d <kinit1>
  kvmalloc();      // kernel page table
8010347c:	e8 db 4a 00 00       	call   80107f5c <kvmalloc>
  mpinit();        // collect info about this machine
80103481:	e8 67 04 00 00       	call   801038ed <mpinit>
  lapicinit(mpbcpu());
80103486:	e8 2e 02 00 00       	call   801036b9 <mpbcpu>
8010348b:	89 04 24             	mov    %eax,(%esp)
8010348e:	e8 ed f8 ff ff       	call   80102d80 <lapicinit>
  seginit();       // set up segments
80103493:	e8 59 44 00 00       	call   801078f1 <seginit>
  cprintf("\ncpu%d: starting xv6\n\n", cpu->id);
80103498:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
8010349e:	0f b6 00             	movzbl (%eax),%eax
801034a1:	0f b6 c0             	movzbl %al,%eax
801034a4:	89 44 24 04          	mov    %eax,0x4(%esp)
801034a8:	c7 04 24 39 89 10 80 	movl   $0x80108939,(%esp)
801034af:	e8 f6 ce ff ff       	call   801003aa <cprintf>
  picinit();       // interrupt controller
801034b4:	e8 99 06 00 00       	call   80103b52 <picinit>
  ioapicinit();    // another interrupt controller
801034b9:	e8 4f f4 ff ff       	call   8010290d <ioapicinit>
  consoleinit();   // I/O devices & their interrupts
801034be:	e8 d5 d5 ff ff       	call   80100a98 <consoleinit>
  uartinit();      // serial port
801034c3:	e8 74 37 00 00       	call   80106c3c <uartinit>
  pinit();         // process table
801034c8:	e8 9e 0b 00 00       	call   8010406b <pinit>
  tvinit();        // trap vectors
801034cd:	e8 01 33 00 00       	call   801067d3 <tvinit>
  binit();         // buffer cache
801034d2:	e8 5d cb ff ff       	call   80100034 <binit>
  fileinit();      // file table
801034d7:	e8 4c da ff ff       	call   80100f28 <fileinit>
  iinit();         // inode cache
801034dc:	e8 fc e0 ff ff       	call   801015dd <iinit>
  ideinit();       // disk
801034e1:	e8 8c f0 ff ff       	call   80102572 <ideinit>
  if(!ismp)
801034e6:	a1 44 f9 10 80       	mov    0x8010f944,%eax
801034eb:	85 c0                	test   %eax,%eax
801034ed:	75 05                	jne    801034f4 <main+0x95>
    timerinit();   // uniprocessor timer
801034ef:	e8 22 32 00 00       	call   80106716 <timerinit>
  startothers();   // start other processors
801034f4:	e8 87 00 00 00       	call   80103580 <startothers>
  kinit2(P2V(4*1024*1024), P2V(PHYSTOP)); // must come after startothers()
801034f9:	c7 44 24 04 00 00 00 	movl   $0x8e000000,0x4(%esp)
80103500:	8e 
80103501:	c7 04 24 00 00 40 80 	movl   $0x80400000,(%esp)
80103508:	e8 48 f5 ff ff       	call   80102a55 <kinit2>
  userinit();      // first user process
8010350d:	e8 b4 0c 00 00       	call   801041c6 <userinit>
  // Finish setting up this processor in mpmain.
  mpmain();
80103512:	e8 22 00 00 00       	call   80103539 <mpmain>

80103517 <mpenter>:
}

// Other CPUs jump here from entryother.S.
static void
mpenter(void)
{
80103517:	55                   	push   %ebp
80103518:	89 e5                	mov    %esp,%ebp
8010351a:	83 ec 18             	sub    $0x18,%esp
  switchkvm(); 
8010351d:	e8 51 4a 00 00       	call   80107f73 <switchkvm>
  seginit();
80103522:	e8 ca 43 00 00       	call   801078f1 <seginit>
  lapicinit(cpunum());
80103527:	e8 b1 f9 ff ff       	call   80102edd <cpunum>
8010352c:	89 04 24             	mov    %eax,(%esp)
8010352f:	e8 4c f8 ff ff       	call   80102d80 <lapicinit>
  mpmain();
80103534:	e8 00 00 00 00       	call   80103539 <mpmain>

80103539 <mpmain>:
}

// Common CPU setup code.
static void
mpmain(void)
{
80103539:	55                   	push   %ebp
8010353a:	89 e5                	mov    %esp,%ebp
8010353c:	83 ec 18             	sub    $0x18,%esp
  cprintf("cpu%d: starting\n", cpu->id);
8010353f:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
80103545:	0f b6 00             	movzbl (%eax),%eax
80103548:	0f b6 c0             	movzbl %al,%eax
8010354b:	89 44 24 04          	mov    %eax,0x4(%esp)
8010354f:	c7 04 24 50 89 10 80 	movl   $0x80108950,(%esp)
80103556:	e8 4f ce ff ff       	call   801003aa <cprintf>
  idtinit();       // load idt register
8010355b:	e8 e7 33 00 00       	call   80106947 <idtinit>
  xchg(&cpu->started, 1); // tell startothers() we're up
80103560:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
80103566:	05 a8 00 00 00       	add    $0xa8,%eax
8010356b:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
80103572:	00 
80103573:	89 04 24             	mov    %eax,(%esp)
80103576:	e8 bf fe ff ff       	call   8010343a <xchg>
  scheduler();     // start running processes
8010357b:	e8 83 12 00 00       	call   80104803 <scheduler>

80103580 <startothers>:
pde_t entrypgdir[];  // For entry.S

// Start the non-boot (AP) processors.
static void
startothers(void)
{
80103580:	55                   	push   %ebp
80103581:	89 e5                	mov    %esp,%ebp
80103583:	53                   	push   %ebx
80103584:	83 ec 24             	sub    $0x24,%esp
  char *stack;

  // Write entry code to unused memory at 0x7000.
  // The linker has placed the image of entryother.S in
  // _binary_entryother_start.
  code = p2v(0x7000);
80103587:	c7 04 24 00 70 00 00 	movl   $0x7000,(%esp)
8010358e:	e8 9a fe ff ff       	call   8010342d <p2v>
80103593:	89 45 f0             	mov    %eax,-0x10(%ebp)
  memmove(code, _binary_entryother_start, (uint)_binary_entryother_size);
80103596:	b8 8a 00 00 00       	mov    $0x8a,%eax
8010359b:	89 44 24 08          	mov    %eax,0x8(%esp)
8010359f:	c7 44 24 04 4c b5 10 	movl   $0x8010b54c,0x4(%esp)
801035a6:	80 
801035a7:	8b 45 f0             	mov    -0x10(%ebp),%eax
801035aa:	89 04 24             	mov    %eax,(%esp)
801035ad:	e8 93 1d 00 00       	call   80105345 <memmove>

  for(c = cpus; c < cpus+ncpu; c++){
801035b2:	c7 45 f4 60 f9 10 80 	movl   $0x8010f960,-0xc(%ebp)
801035b9:	e9 86 00 00 00       	jmp    80103644 <startothers+0xc4>
    if(c == cpus+cpunum())  // We've started already.
801035be:	e8 1a f9 ff ff       	call   80102edd <cpunum>
801035c3:	69 c0 bc 00 00 00    	imul   $0xbc,%eax,%eax
801035c9:	05 60 f9 10 80       	add    $0x8010f960,%eax
801035ce:	3b 45 f4             	cmp    -0xc(%ebp),%eax
801035d1:	74 69                	je     8010363c <startothers+0xbc>
      continue;

    // Tell entryother.S what stack to use, where to enter, and what 
    // pgdir to use. We cannot use kpgdir yet, because the AP processor
    // is running in low  memory, so we use entrypgdir for the APs too.
    stack = kalloc();
801035d3:	e8 73 f5 ff ff       	call   80102b4b <kalloc>
801035d8:	89 45 ec             	mov    %eax,-0x14(%ebp)
    *(void**)(code-4) = stack + KSTACKSIZE;
801035db:	8b 45 f0             	mov    -0x10(%ebp),%eax
801035de:	83 e8 04             	sub    $0x4,%eax
801035e1:	8b 55 ec             	mov    -0x14(%ebp),%edx
801035e4:	81 c2 00 10 00 00    	add    $0x1000,%edx
801035ea:	89 10                	mov    %edx,(%eax)
    *(void**)(code-8) = mpenter;
801035ec:	8b 45 f0             	mov    -0x10(%ebp),%eax
801035ef:	83 e8 08             	sub    $0x8,%eax
801035f2:	c7 00 17 35 10 80    	movl   $0x80103517,(%eax)
    *(int**)(code-12) = (void *) v2p(entrypgdir);
801035f8:	8b 45 f0             	mov    -0x10(%ebp),%eax
801035fb:	8d 58 f4             	lea    -0xc(%eax),%ebx
801035fe:	c7 04 24 00 a0 10 80 	movl   $0x8010a000,(%esp)
80103605:	e8 16 fe ff ff       	call   80103420 <v2p>
8010360a:	89 03                	mov    %eax,(%ebx)

    lapicstartap(c->id, v2p(code));
8010360c:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010360f:	89 04 24             	mov    %eax,(%esp)
80103612:	e8 09 fe ff ff       	call   80103420 <v2p>
80103617:	8b 55 f4             	mov    -0xc(%ebp),%edx
8010361a:	0f b6 12             	movzbl (%edx),%edx
8010361d:	0f b6 d2             	movzbl %dl,%edx
80103620:	89 44 24 04          	mov    %eax,0x4(%esp)
80103624:	89 14 24             	mov    %edx,(%esp)
80103627:	e8 37 f9 ff ff       	call   80102f63 <lapicstartap>

    // wait for cpu to finish mpmain()
    while(c->started == 0)
8010362c:	90                   	nop
8010362d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103630:	8b 80 a8 00 00 00    	mov    0xa8(%eax),%eax
80103636:	85 c0                	test   %eax,%eax
80103638:	74 f3                	je     8010362d <startothers+0xad>
8010363a:	eb 01                	jmp    8010363d <startothers+0xbd>
  code = p2v(0x7000);
  memmove(code, _binary_entryother_start, (uint)_binary_entryother_size);

  for(c = cpus; c < cpus+ncpu; c++){
    if(c == cpus+cpunum())  // We've started already.
      continue;
8010363c:	90                   	nop
  // The linker has placed the image of entryother.S in
  // _binary_entryother_start.
  code = p2v(0x7000);
  memmove(code, _binary_entryother_start, (uint)_binary_entryother_size);

  for(c = cpus; c < cpus+ncpu; c++){
8010363d:	81 45 f4 bc 00 00 00 	addl   $0xbc,-0xc(%ebp)
80103644:	a1 40 ff 10 80       	mov    0x8010ff40,%eax
80103649:	69 c0 bc 00 00 00    	imul   $0xbc,%eax,%eax
8010364f:	05 60 f9 10 80       	add    $0x8010f960,%eax
80103654:	3b 45 f4             	cmp    -0xc(%ebp),%eax
80103657:	0f 87 61 ff ff ff    	ja     801035be <startothers+0x3e>

    // wait for cpu to finish mpmain()
    while(c->started == 0)
      ;
  }
}
8010365d:	83 c4 24             	add    $0x24,%esp
80103660:	5b                   	pop    %ebx
80103661:	5d                   	pop    %ebp
80103662:	c3                   	ret    
80103663:	90                   	nop

80103664 <p2v>:
80103664:	55                   	push   %ebp
80103665:	89 e5                	mov    %esp,%ebp
80103667:	8b 45 08             	mov    0x8(%ebp),%eax
8010366a:	05 00 00 00 80       	add    $0x80000000,%eax
8010366f:	5d                   	pop    %ebp
80103670:	c3                   	ret    

80103671 <inb>:
// Routines to let C code use special x86 instructions.

static inline uchar
inb(ushort port)
{
80103671:	55                   	push   %ebp
80103672:	89 e5                	mov    %esp,%ebp
80103674:	53                   	push   %ebx
80103675:	83 ec 14             	sub    $0x14,%esp
80103678:	8b 45 08             	mov    0x8(%ebp),%eax
8010367b:	66 89 45 e8          	mov    %ax,-0x18(%ebp)
  uchar data;

  asm volatile("in %1,%0" : "=a" (data) : "d" (port));
8010367f:	0f b7 55 e8          	movzwl -0x18(%ebp),%edx
80103683:	66 89 55 ea          	mov    %dx,-0x16(%ebp)
80103687:	0f b7 55 ea          	movzwl -0x16(%ebp),%edx
8010368b:	ec                   	in     (%dx),%al
8010368c:	89 c3                	mov    %eax,%ebx
8010368e:	88 5d fb             	mov    %bl,-0x5(%ebp)
  return data;
80103691:	0f b6 45 fb          	movzbl -0x5(%ebp),%eax
}
80103695:	83 c4 14             	add    $0x14,%esp
80103698:	5b                   	pop    %ebx
80103699:	5d                   	pop    %ebp
8010369a:	c3                   	ret    

8010369b <outb>:
               "memory", "cc");
}

static inline void
outb(ushort port, uchar data)
{
8010369b:	55                   	push   %ebp
8010369c:	89 e5                	mov    %esp,%ebp
8010369e:	83 ec 08             	sub    $0x8,%esp
801036a1:	8b 55 08             	mov    0x8(%ebp),%edx
801036a4:	8b 45 0c             	mov    0xc(%ebp),%eax
801036a7:	66 89 55 fc          	mov    %dx,-0x4(%ebp)
801036ab:	88 45 f8             	mov    %al,-0x8(%ebp)
  asm volatile("out %0,%1" : : "a" (data), "d" (port));
801036ae:	0f b6 45 f8          	movzbl -0x8(%ebp),%eax
801036b2:	0f b7 55 fc          	movzwl -0x4(%ebp),%edx
801036b6:	ee                   	out    %al,(%dx)
}
801036b7:	c9                   	leave  
801036b8:	c3                   	ret    

801036b9 <mpbcpu>:
int ncpu;
uchar ioapicid;

int
mpbcpu(void)
{
801036b9:	55                   	push   %ebp
801036ba:	89 e5                	mov    %esp,%ebp
  return bcpu-cpus;
801036bc:	a1 84 b6 10 80       	mov    0x8010b684,%eax
801036c1:	89 c2                	mov    %eax,%edx
801036c3:	b8 60 f9 10 80       	mov    $0x8010f960,%eax
801036c8:	89 d1                	mov    %edx,%ecx
801036ca:	29 c1                	sub    %eax,%ecx
801036cc:	89 c8                	mov    %ecx,%eax
801036ce:	c1 f8 02             	sar    $0x2,%eax
801036d1:	69 c0 cf 46 7d 67    	imul   $0x677d46cf,%eax,%eax
}
801036d7:	5d                   	pop    %ebp
801036d8:	c3                   	ret    

801036d9 <sum>:

static uchar
sum(uchar *addr, int len)
{
801036d9:	55                   	push   %ebp
801036da:	89 e5                	mov    %esp,%ebp
801036dc:	83 ec 10             	sub    $0x10,%esp
  int i, sum;
  
  sum = 0;
801036df:	c7 45 f8 00 00 00 00 	movl   $0x0,-0x8(%ebp)
  for(i=0; i<len; i++)
801036e6:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
801036ed:	eb 15                	jmp    80103704 <sum+0x2b>
    sum += addr[i];
801036ef:	8b 55 fc             	mov    -0x4(%ebp),%edx
801036f2:	8b 45 08             	mov    0x8(%ebp),%eax
801036f5:	01 d0                	add    %edx,%eax
801036f7:	0f b6 00             	movzbl (%eax),%eax
801036fa:	0f b6 c0             	movzbl %al,%eax
801036fd:	01 45 f8             	add    %eax,-0x8(%ebp)
sum(uchar *addr, int len)
{
  int i, sum;
  
  sum = 0;
  for(i=0; i<len; i++)
80103700:	83 45 fc 01          	addl   $0x1,-0x4(%ebp)
80103704:	8b 45 fc             	mov    -0x4(%ebp),%eax
80103707:	3b 45 0c             	cmp    0xc(%ebp),%eax
8010370a:	7c e3                	jl     801036ef <sum+0x16>
    sum += addr[i];
  return sum;
8010370c:	8b 45 f8             	mov    -0x8(%ebp),%eax
}
8010370f:	c9                   	leave  
80103710:	c3                   	ret    

80103711 <mpsearch1>:

// Look for an MP structure in the len bytes at addr.
static struct mp*
mpsearch1(uint a, int len)
{
80103711:	55                   	push   %ebp
80103712:	89 e5                	mov    %esp,%ebp
80103714:	83 ec 28             	sub    $0x28,%esp
  uchar *e, *p, *addr;

  addr = p2v(a);
80103717:	8b 45 08             	mov    0x8(%ebp),%eax
8010371a:	89 04 24             	mov    %eax,(%esp)
8010371d:	e8 42 ff ff ff       	call   80103664 <p2v>
80103722:	89 45 f0             	mov    %eax,-0x10(%ebp)
  e = addr+len;
80103725:	8b 55 0c             	mov    0xc(%ebp),%edx
80103728:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010372b:	01 d0                	add    %edx,%eax
8010372d:	89 45 ec             	mov    %eax,-0x14(%ebp)
  for(p = addr; p < e; p += sizeof(struct mp))
80103730:	8b 45 f0             	mov    -0x10(%ebp),%eax
80103733:	89 45 f4             	mov    %eax,-0xc(%ebp)
80103736:	eb 3f                	jmp    80103777 <mpsearch1+0x66>
    if(memcmp(p, "_MP_", 4) == 0 && sum(p, sizeof(struct mp)) == 0)
80103738:	c7 44 24 08 04 00 00 	movl   $0x4,0x8(%esp)
8010373f:	00 
80103740:	c7 44 24 04 64 89 10 	movl   $0x80108964,0x4(%esp)
80103747:	80 
80103748:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010374b:	89 04 24             	mov    %eax,(%esp)
8010374e:	e8 96 1b 00 00       	call   801052e9 <memcmp>
80103753:	85 c0                	test   %eax,%eax
80103755:	75 1c                	jne    80103773 <mpsearch1+0x62>
80103757:	c7 44 24 04 10 00 00 	movl   $0x10,0x4(%esp)
8010375e:	00 
8010375f:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103762:	89 04 24             	mov    %eax,(%esp)
80103765:	e8 6f ff ff ff       	call   801036d9 <sum>
8010376a:	84 c0                	test   %al,%al
8010376c:	75 05                	jne    80103773 <mpsearch1+0x62>
      return (struct mp*)p;
8010376e:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103771:	eb 11                	jmp    80103784 <mpsearch1+0x73>
{
  uchar *e, *p, *addr;

  addr = p2v(a);
  e = addr+len;
  for(p = addr; p < e; p += sizeof(struct mp))
80103773:	83 45 f4 10          	addl   $0x10,-0xc(%ebp)
80103777:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010377a:	3b 45 ec             	cmp    -0x14(%ebp),%eax
8010377d:	72 b9                	jb     80103738 <mpsearch1+0x27>
    if(memcmp(p, "_MP_", 4) == 0 && sum(p, sizeof(struct mp)) == 0)
      return (struct mp*)p;
  return 0;
8010377f:	b8 00 00 00 00       	mov    $0x0,%eax
}
80103784:	c9                   	leave  
80103785:	c3                   	ret    

80103786 <mpsearch>:
// 1) in the first KB of the EBDA;
// 2) in the last KB of system base memory;
// 3) in the BIOS ROM between 0xE0000 and 0xFFFFF.
static struct mp*
mpsearch(void)
{
80103786:	55                   	push   %ebp
80103787:	89 e5                	mov    %esp,%ebp
80103789:	83 ec 28             	sub    $0x28,%esp
  uchar *bda;
  uint p;
  struct mp *mp;

  bda = (uchar *) P2V(0x400);
8010378c:	c7 45 f4 00 04 00 80 	movl   $0x80000400,-0xc(%ebp)
  if((p = ((bda[0x0F]<<8)| bda[0x0E]) << 4)){
80103793:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103796:	83 c0 0f             	add    $0xf,%eax
80103799:	0f b6 00             	movzbl (%eax),%eax
8010379c:	0f b6 c0             	movzbl %al,%eax
8010379f:	89 c2                	mov    %eax,%edx
801037a1:	c1 e2 08             	shl    $0x8,%edx
801037a4:	8b 45 f4             	mov    -0xc(%ebp),%eax
801037a7:	83 c0 0e             	add    $0xe,%eax
801037aa:	0f b6 00             	movzbl (%eax),%eax
801037ad:	0f b6 c0             	movzbl %al,%eax
801037b0:	09 d0                	or     %edx,%eax
801037b2:	c1 e0 04             	shl    $0x4,%eax
801037b5:	89 45 f0             	mov    %eax,-0x10(%ebp)
801037b8:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
801037bc:	74 21                	je     801037df <mpsearch+0x59>
    if((mp = mpsearch1(p, 1024)))
801037be:	c7 44 24 04 00 04 00 	movl   $0x400,0x4(%esp)
801037c5:	00 
801037c6:	8b 45 f0             	mov    -0x10(%ebp),%eax
801037c9:	89 04 24             	mov    %eax,(%esp)
801037cc:	e8 40 ff ff ff       	call   80103711 <mpsearch1>
801037d1:	89 45 ec             	mov    %eax,-0x14(%ebp)
801037d4:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
801037d8:	74 50                	je     8010382a <mpsearch+0xa4>
      return mp;
801037da:	8b 45 ec             	mov    -0x14(%ebp),%eax
801037dd:	eb 5f                	jmp    8010383e <mpsearch+0xb8>
  } else {
    p = ((bda[0x14]<<8)|bda[0x13])*1024;
801037df:	8b 45 f4             	mov    -0xc(%ebp),%eax
801037e2:	83 c0 14             	add    $0x14,%eax
801037e5:	0f b6 00             	movzbl (%eax),%eax
801037e8:	0f b6 c0             	movzbl %al,%eax
801037eb:	89 c2                	mov    %eax,%edx
801037ed:	c1 e2 08             	shl    $0x8,%edx
801037f0:	8b 45 f4             	mov    -0xc(%ebp),%eax
801037f3:	83 c0 13             	add    $0x13,%eax
801037f6:	0f b6 00             	movzbl (%eax),%eax
801037f9:	0f b6 c0             	movzbl %al,%eax
801037fc:	09 d0                	or     %edx,%eax
801037fe:	c1 e0 0a             	shl    $0xa,%eax
80103801:	89 45 f0             	mov    %eax,-0x10(%ebp)
    if((mp = mpsearch1(p-1024, 1024)))
80103804:	8b 45 f0             	mov    -0x10(%ebp),%eax
80103807:	2d 00 04 00 00       	sub    $0x400,%eax
8010380c:	c7 44 24 04 00 04 00 	movl   $0x400,0x4(%esp)
80103813:	00 
80103814:	89 04 24             	mov    %eax,(%esp)
80103817:	e8 f5 fe ff ff       	call   80103711 <mpsearch1>
8010381c:	89 45 ec             	mov    %eax,-0x14(%ebp)
8010381f:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
80103823:	74 05                	je     8010382a <mpsearch+0xa4>
      return mp;
80103825:	8b 45 ec             	mov    -0x14(%ebp),%eax
80103828:	eb 14                	jmp    8010383e <mpsearch+0xb8>
  }
  return mpsearch1(0xF0000, 0x10000);
8010382a:	c7 44 24 04 00 00 01 	movl   $0x10000,0x4(%esp)
80103831:	00 
80103832:	c7 04 24 00 00 0f 00 	movl   $0xf0000,(%esp)
80103839:	e8 d3 fe ff ff       	call   80103711 <mpsearch1>
}
8010383e:	c9                   	leave  
8010383f:	c3                   	ret    

80103840 <mpconfig>:
// Check for correct signature, calculate the checksum and,
// if correct, check the version.
// To do: check extended table checksum.
static struct mpconf*
mpconfig(struct mp **pmp)
{
80103840:	55                   	push   %ebp
80103841:	89 e5                	mov    %esp,%ebp
80103843:	83 ec 28             	sub    $0x28,%esp
  struct mpconf *conf;
  struct mp *mp;

  if((mp = mpsearch()) == 0 || mp->physaddr == 0)
80103846:	e8 3b ff ff ff       	call   80103786 <mpsearch>
8010384b:	89 45 f4             	mov    %eax,-0xc(%ebp)
8010384e:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80103852:	74 0a                	je     8010385e <mpconfig+0x1e>
80103854:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103857:	8b 40 04             	mov    0x4(%eax),%eax
8010385a:	85 c0                	test   %eax,%eax
8010385c:	75 0a                	jne    80103868 <mpconfig+0x28>
    return 0;
8010385e:	b8 00 00 00 00       	mov    $0x0,%eax
80103863:	e9 83 00 00 00       	jmp    801038eb <mpconfig+0xab>
  conf = (struct mpconf*) p2v((uint) mp->physaddr);
80103868:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010386b:	8b 40 04             	mov    0x4(%eax),%eax
8010386e:	89 04 24             	mov    %eax,(%esp)
80103871:	e8 ee fd ff ff       	call   80103664 <p2v>
80103876:	89 45 f0             	mov    %eax,-0x10(%ebp)
  if(memcmp(conf, "PCMP", 4) != 0)
80103879:	c7 44 24 08 04 00 00 	movl   $0x4,0x8(%esp)
80103880:	00 
80103881:	c7 44 24 04 69 89 10 	movl   $0x80108969,0x4(%esp)
80103888:	80 
80103889:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010388c:	89 04 24             	mov    %eax,(%esp)
8010388f:	e8 55 1a 00 00       	call   801052e9 <memcmp>
80103894:	85 c0                	test   %eax,%eax
80103896:	74 07                	je     8010389f <mpconfig+0x5f>
    return 0;
80103898:	b8 00 00 00 00       	mov    $0x0,%eax
8010389d:	eb 4c                	jmp    801038eb <mpconfig+0xab>
  if(conf->version != 1 && conf->version != 4)
8010389f:	8b 45 f0             	mov    -0x10(%ebp),%eax
801038a2:	0f b6 40 06          	movzbl 0x6(%eax),%eax
801038a6:	3c 01                	cmp    $0x1,%al
801038a8:	74 12                	je     801038bc <mpconfig+0x7c>
801038aa:	8b 45 f0             	mov    -0x10(%ebp),%eax
801038ad:	0f b6 40 06          	movzbl 0x6(%eax),%eax
801038b1:	3c 04                	cmp    $0x4,%al
801038b3:	74 07                	je     801038bc <mpconfig+0x7c>
    return 0;
801038b5:	b8 00 00 00 00       	mov    $0x0,%eax
801038ba:	eb 2f                	jmp    801038eb <mpconfig+0xab>
  if(sum((uchar*)conf, conf->length) != 0)
801038bc:	8b 45 f0             	mov    -0x10(%ebp),%eax
801038bf:	0f b7 40 04          	movzwl 0x4(%eax),%eax
801038c3:	0f b7 c0             	movzwl %ax,%eax
801038c6:	89 44 24 04          	mov    %eax,0x4(%esp)
801038ca:	8b 45 f0             	mov    -0x10(%ebp),%eax
801038cd:	89 04 24             	mov    %eax,(%esp)
801038d0:	e8 04 fe ff ff       	call   801036d9 <sum>
801038d5:	84 c0                	test   %al,%al
801038d7:	74 07                	je     801038e0 <mpconfig+0xa0>
    return 0;
801038d9:	b8 00 00 00 00       	mov    $0x0,%eax
801038de:	eb 0b                	jmp    801038eb <mpconfig+0xab>
  *pmp = mp;
801038e0:	8b 45 08             	mov    0x8(%ebp),%eax
801038e3:	8b 55 f4             	mov    -0xc(%ebp),%edx
801038e6:	89 10                	mov    %edx,(%eax)
  return conf;
801038e8:	8b 45 f0             	mov    -0x10(%ebp),%eax
}
801038eb:	c9                   	leave  
801038ec:	c3                   	ret    

801038ed <mpinit>:

void
mpinit(void)
{
801038ed:	55                   	push   %ebp
801038ee:	89 e5                	mov    %esp,%ebp
801038f0:	83 ec 38             	sub    $0x38,%esp
  struct mp *mp;
  struct mpconf *conf;
  struct mpproc *proc;
  struct mpioapic *ioapic;

  bcpu = &cpus[0];
801038f3:	c7 05 84 b6 10 80 60 	movl   $0x8010f960,0x8010b684
801038fa:	f9 10 80 
  if((conf = mpconfig(&mp)) == 0)
801038fd:	8d 45 e0             	lea    -0x20(%ebp),%eax
80103900:	89 04 24             	mov    %eax,(%esp)
80103903:	e8 38 ff ff ff       	call   80103840 <mpconfig>
80103908:	89 45 f0             	mov    %eax,-0x10(%ebp)
8010390b:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
8010390f:	0f 84 9c 01 00 00    	je     80103ab1 <mpinit+0x1c4>
    return;
  ismp = 1;
80103915:	c7 05 44 f9 10 80 01 	movl   $0x1,0x8010f944
8010391c:	00 00 00 
  lapic = (uint*)conf->lapicaddr;
8010391f:	8b 45 f0             	mov    -0x10(%ebp),%eax
80103922:	8b 40 24             	mov    0x24(%eax),%eax
80103925:	a3 bc f8 10 80       	mov    %eax,0x8010f8bc
  for(p=(uchar*)(conf+1), e=(uchar*)conf+conf->length; p<e; ){
8010392a:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010392d:	83 c0 2c             	add    $0x2c,%eax
80103930:	89 45 f4             	mov    %eax,-0xc(%ebp)
80103933:	8b 45 f0             	mov    -0x10(%ebp),%eax
80103936:	0f b7 40 04          	movzwl 0x4(%eax),%eax
8010393a:	0f b7 d0             	movzwl %ax,%edx
8010393d:	8b 45 f0             	mov    -0x10(%ebp),%eax
80103940:	01 d0                	add    %edx,%eax
80103942:	89 45 ec             	mov    %eax,-0x14(%ebp)
80103945:	e9 f4 00 00 00       	jmp    80103a3e <mpinit+0x151>
    switch(*p){
8010394a:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010394d:	0f b6 00             	movzbl (%eax),%eax
80103950:	0f b6 c0             	movzbl %al,%eax
80103953:	83 f8 04             	cmp    $0x4,%eax
80103956:	0f 87 bf 00 00 00    	ja     80103a1b <mpinit+0x12e>
8010395c:	8b 04 85 ac 89 10 80 	mov    -0x7fef7654(,%eax,4),%eax
80103963:	ff e0                	jmp    *%eax
    case MPPROC:
      proc = (struct mpproc*)p;
80103965:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103968:	89 45 e8             	mov    %eax,-0x18(%ebp)
      if(ncpu != proc->apicid){
8010396b:	8b 45 e8             	mov    -0x18(%ebp),%eax
8010396e:	0f b6 40 01          	movzbl 0x1(%eax),%eax
80103972:	0f b6 d0             	movzbl %al,%edx
80103975:	a1 40 ff 10 80       	mov    0x8010ff40,%eax
8010397a:	39 c2                	cmp    %eax,%edx
8010397c:	74 2d                	je     801039ab <mpinit+0xbe>
        cprintf("mpinit: ncpu=%d apicid=%d\n", ncpu, proc->apicid);
8010397e:	8b 45 e8             	mov    -0x18(%ebp),%eax
80103981:	0f b6 40 01          	movzbl 0x1(%eax),%eax
80103985:	0f b6 d0             	movzbl %al,%edx
80103988:	a1 40 ff 10 80       	mov    0x8010ff40,%eax
8010398d:	89 54 24 08          	mov    %edx,0x8(%esp)
80103991:	89 44 24 04          	mov    %eax,0x4(%esp)
80103995:	c7 04 24 6e 89 10 80 	movl   $0x8010896e,(%esp)
8010399c:	e8 09 ca ff ff       	call   801003aa <cprintf>
        ismp = 0;
801039a1:	c7 05 44 f9 10 80 00 	movl   $0x0,0x8010f944
801039a8:	00 00 00 
      }
      if(proc->flags & MPBOOT)
801039ab:	8b 45 e8             	mov    -0x18(%ebp),%eax
801039ae:	0f b6 40 03          	movzbl 0x3(%eax),%eax
801039b2:	0f b6 c0             	movzbl %al,%eax
801039b5:	83 e0 02             	and    $0x2,%eax
801039b8:	85 c0                	test   %eax,%eax
801039ba:	74 15                	je     801039d1 <mpinit+0xe4>
        bcpu = &cpus[ncpu];
801039bc:	a1 40 ff 10 80       	mov    0x8010ff40,%eax
801039c1:	69 c0 bc 00 00 00    	imul   $0xbc,%eax,%eax
801039c7:	05 60 f9 10 80       	add    $0x8010f960,%eax
801039cc:	a3 84 b6 10 80       	mov    %eax,0x8010b684
      cpus[ncpu].id = ncpu;
801039d1:	8b 15 40 ff 10 80    	mov    0x8010ff40,%edx
801039d7:	a1 40 ff 10 80       	mov    0x8010ff40,%eax
801039dc:	69 d2 bc 00 00 00    	imul   $0xbc,%edx,%edx
801039e2:	81 c2 60 f9 10 80    	add    $0x8010f960,%edx
801039e8:	88 02                	mov    %al,(%edx)
      ncpu++;
801039ea:	a1 40 ff 10 80       	mov    0x8010ff40,%eax
801039ef:	83 c0 01             	add    $0x1,%eax
801039f2:	a3 40 ff 10 80       	mov    %eax,0x8010ff40
      p += sizeof(struct mpproc);
801039f7:	83 45 f4 14          	addl   $0x14,-0xc(%ebp)
      continue;
801039fb:	eb 41                	jmp    80103a3e <mpinit+0x151>
    case MPIOAPIC:
      ioapic = (struct mpioapic*)p;
801039fd:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103a00:	89 45 e4             	mov    %eax,-0x1c(%ebp)
      ioapicid = ioapic->apicno;
80103a03:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80103a06:	0f b6 40 01          	movzbl 0x1(%eax),%eax
80103a0a:	a2 40 f9 10 80       	mov    %al,0x8010f940
      p += sizeof(struct mpioapic);
80103a0f:	83 45 f4 08          	addl   $0x8,-0xc(%ebp)
      continue;
80103a13:	eb 29                	jmp    80103a3e <mpinit+0x151>
    case MPBUS:
    case MPIOINTR:
    case MPLINTR:
      p += 8;
80103a15:	83 45 f4 08          	addl   $0x8,-0xc(%ebp)
      continue;
80103a19:	eb 23                	jmp    80103a3e <mpinit+0x151>
    default:
      cprintf("mpinit: unknown config type %x\n", *p);
80103a1b:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103a1e:	0f b6 00             	movzbl (%eax),%eax
80103a21:	0f b6 c0             	movzbl %al,%eax
80103a24:	89 44 24 04          	mov    %eax,0x4(%esp)
80103a28:	c7 04 24 8c 89 10 80 	movl   $0x8010898c,(%esp)
80103a2f:	e8 76 c9 ff ff       	call   801003aa <cprintf>
      ismp = 0;
80103a34:	c7 05 44 f9 10 80 00 	movl   $0x0,0x8010f944
80103a3b:	00 00 00 
  bcpu = &cpus[0];
  if((conf = mpconfig(&mp)) == 0)
    return;
  ismp = 1;
  lapic = (uint*)conf->lapicaddr;
  for(p=(uchar*)(conf+1), e=(uchar*)conf+conf->length; p<e; ){
80103a3e:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103a41:	3b 45 ec             	cmp    -0x14(%ebp),%eax
80103a44:	0f 82 00 ff ff ff    	jb     8010394a <mpinit+0x5d>
    default:
      cprintf("mpinit: unknown config type %x\n", *p);
      ismp = 0;
    }
  }
  if(!ismp){
80103a4a:	a1 44 f9 10 80       	mov    0x8010f944,%eax
80103a4f:	85 c0                	test   %eax,%eax
80103a51:	75 1d                	jne    80103a70 <mpinit+0x183>
    // Didn't like what we found; fall back to no MP.
    ncpu = 1;
80103a53:	c7 05 40 ff 10 80 01 	movl   $0x1,0x8010ff40
80103a5a:	00 00 00 
    lapic = 0;
80103a5d:	c7 05 bc f8 10 80 00 	movl   $0x0,0x8010f8bc
80103a64:	00 00 00 
    ioapicid = 0;
80103a67:	c6 05 40 f9 10 80 00 	movb   $0x0,0x8010f940
80103a6e:	eb 41                	jmp    80103ab1 <mpinit+0x1c4>
    return;
  }

  if(mp->imcrp){
80103a70:	8b 45 e0             	mov    -0x20(%ebp),%eax
80103a73:	0f b6 40 0c          	movzbl 0xc(%eax),%eax
80103a77:	84 c0                	test   %al,%al
80103a79:	74 36                	je     80103ab1 <mpinit+0x1c4>
    // Bochs doesn't support IMCR, so this doesn't run on Bochs.
    // But it would on real hardware.
    outb(0x22, 0x70);   // Select IMCR
80103a7b:	c7 44 24 04 70 00 00 	movl   $0x70,0x4(%esp)
80103a82:	00 
80103a83:	c7 04 24 22 00 00 00 	movl   $0x22,(%esp)
80103a8a:	e8 0c fc ff ff       	call   8010369b <outb>
    outb(0x23, inb(0x23) | 1);  // Mask external interrupts.
80103a8f:	c7 04 24 23 00 00 00 	movl   $0x23,(%esp)
80103a96:	e8 d6 fb ff ff       	call   80103671 <inb>
80103a9b:	83 c8 01             	or     $0x1,%eax
80103a9e:	0f b6 c0             	movzbl %al,%eax
80103aa1:	89 44 24 04          	mov    %eax,0x4(%esp)
80103aa5:	c7 04 24 23 00 00 00 	movl   $0x23,(%esp)
80103aac:	e8 ea fb ff ff       	call   8010369b <outb>
  }
}
80103ab1:	c9                   	leave  
80103ab2:	c3                   	ret    
80103ab3:	90                   	nop

80103ab4 <outb>:
               "memory", "cc");
}

static inline void
outb(ushort port, uchar data)
{
80103ab4:	55                   	push   %ebp
80103ab5:	89 e5                	mov    %esp,%ebp
80103ab7:	83 ec 08             	sub    $0x8,%esp
80103aba:	8b 55 08             	mov    0x8(%ebp),%edx
80103abd:	8b 45 0c             	mov    0xc(%ebp),%eax
80103ac0:	66 89 55 fc          	mov    %dx,-0x4(%ebp)
80103ac4:	88 45 f8             	mov    %al,-0x8(%ebp)
  asm volatile("out %0,%1" : : "a" (data), "d" (port));
80103ac7:	0f b6 45 f8          	movzbl -0x8(%ebp),%eax
80103acb:	0f b7 55 fc          	movzwl -0x4(%ebp),%edx
80103acf:	ee                   	out    %al,(%dx)
}
80103ad0:	c9                   	leave  
80103ad1:	c3                   	ret    

80103ad2 <picsetmask>:
// Initial IRQ mask has interrupt 2 enabled (for slave 8259A).
static ushort irqmask = 0xFFFF & ~(1<<IRQ_SLAVE);

static void
picsetmask(ushort mask)
{
80103ad2:	55                   	push   %ebp
80103ad3:	89 e5                	mov    %esp,%ebp
80103ad5:	83 ec 0c             	sub    $0xc,%esp
80103ad8:	8b 45 08             	mov    0x8(%ebp),%eax
80103adb:	66 89 45 fc          	mov    %ax,-0x4(%ebp)
  irqmask = mask;
80103adf:	0f b7 45 fc          	movzwl -0x4(%ebp),%eax
80103ae3:	66 a3 00 b0 10 80    	mov    %ax,0x8010b000
  outb(IO_PIC1+1, mask);
80103ae9:	0f b7 45 fc          	movzwl -0x4(%ebp),%eax
80103aed:	0f b6 c0             	movzbl %al,%eax
80103af0:	89 44 24 04          	mov    %eax,0x4(%esp)
80103af4:	c7 04 24 21 00 00 00 	movl   $0x21,(%esp)
80103afb:	e8 b4 ff ff ff       	call   80103ab4 <outb>
  outb(IO_PIC2+1, mask >> 8);
80103b00:	0f b7 45 fc          	movzwl -0x4(%ebp),%eax
80103b04:	66 c1 e8 08          	shr    $0x8,%ax
80103b08:	0f b6 c0             	movzbl %al,%eax
80103b0b:	89 44 24 04          	mov    %eax,0x4(%esp)
80103b0f:	c7 04 24 a1 00 00 00 	movl   $0xa1,(%esp)
80103b16:	e8 99 ff ff ff       	call   80103ab4 <outb>
}
80103b1b:	c9                   	leave  
80103b1c:	c3                   	ret    

80103b1d <picenable>:

void
picenable(int irq)
{
80103b1d:	55                   	push   %ebp
80103b1e:	89 e5                	mov    %esp,%ebp
80103b20:	53                   	push   %ebx
80103b21:	83 ec 04             	sub    $0x4,%esp
  picsetmask(irqmask & ~(1<<irq));
80103b24:	8b 45 08             	mov    0x8(%ebp),%eax
80103b27:	ba 01 00 00 00       	mov    $0x1,%edx
80103b2c:	89 d3                	mov    %edx,%ebx
80103b2e:	89 c1                	mov    %eax,%ecx
80103b30:	d3 e3                	shl    %cl,%ebx
80103b32:	89 d8                	mov    %ebx,%eax
80103b34:	89 c2                	mov    %eax,%edx
80103b36:	f7 d2                	not    %edx
80103b38:	0f b7 05 00 b0 10 80 	movzwl 0x8010b000,%eax
80103b3f:	21 d0                	and    %edx,%eax
80103b41:	0f b7 c0             	movzwl %ax,%eax
80103b44:	89 04 24             	mov    %eax,(%esp)
80103b47:	e8 86 ff ff ff       	call   80103ad2 <picsetmask>
}
80103b4c:	83 c4 04             	add    $0x4,%esp
80103b4f:	5b                   	pop    %ebx
80103b50:	5d                   	pop    %ebp
80103b51:	c3                   	ret    

80103b52 <picinit>:

// Initialize the 8259A interrupt controllers.
void
picinit(void)
{
80103b52:	55                   	push   %ebp
80103b53:	89 e5                	mov    %esp,%ebp
80103b55:	83 ec 08             	sub    $0x8,%esp
  // mask all interrupts
  outb(IO_PIC1+1, 0xFF);
80103b58:	c7 44 24 04 ff 00 00 	movl   $0xff,0x4(%esp)
80103b5f:	00 
80103b60:	c7 04 24 21 00 00 00 	movl   $0x21,(%esp)
80103b67:	e8 48 ff ff ff       	call   80103ab4 <outb>
  outb(IO_PIC2+1, 0xFF);
80103b6c:	c7 44 24 04 ff 00 00 	movl   $0xff,0x4(%esp)
80103b73:	00 
80103b74:	c7 04 24 a1 00 00 00 	movl   $0xa1,(%esp)
80103b7b:	e8 34 ff ff ff       	call   80103ab4 <outb>

  // ICW1:  0001g0hi
  //    g:  0 = edge triggering, 1 = level triggering
  //    h:  0 = cascaded PICs, 1 = master only
  //    i:  0 = no ICW4, 1 = ICW4 required
  outb(IO_PIC1, 0x11);
80103b80:	c7 44 24 04 11 00 00 	movl   $0x11,0x4(%esp)
80103b87:	00 
80103b88:	c7 04 24 20 00 00 00 	movl   $0x20,(%esp)
80103b8f:	e8 20 ff ff ff       	call   80103ab4 <outb>

  // ICW2:  Vector offset
  outb(IO_PIC1+1, T_IRQ0);
80103b94:	c7 44 24 04 20 00 00 	movl   $0x20,0x4(%esp)
80103b9b:	00 
80103b9c:	c7 04 24 21 00 00 00 	movl   $0x21,(%esp)
80103ba3:	e8 0c ff ff ff       	call   80103ab4 <outb>

  // ICW3:  (master PIC) bit mask of IR lines connected to slaves
  //        (slave PIC) 3-bit # of slave's connection to master
  outb(IO_PIC1+1, 1<<IRQ_SLAVE);
80103ba8:	c7 44 24 04 04 00 00 	movl   $0x4,0x4(%esp)
80103baf:	00 
80103bb0:	c7 04 24 21 00 00 00 	movl   $0x21,(%esp)
80103bb7:	e8 f8 fe ff ff       	call   80103ab4 <outb>
  //    m:  0 = slave PIC, 1 = master PIC
  //      (ignored when b is 0, as the master/slave role
  //      can be hardwired).
  //    a:  1 = Automatic EOI mode
  //    p:  0 = MCS-80/85 mode, 1 = intel x86 mode
  outb(IO_PIC1+1, 0x3);
80103bbc:	c7 44 24 04 03 00 00 	movl   $0x3,0x4(%esp)
80103bc3:	00 
80103bc4:	c7 04 24 21 00 00 00 	movl   $0x21,(%esp)
80103bcb:	e8 e4 fe ff ff       	call   80103ab4 <outb>

  // Set up slave (8259A-2)
  outb(IO_PIC2, 0x11);                  // ICW1
80103bd0:	c7 44 24 04 11 00 00 	movl   $0x11,0x4(%esp)
80103bd7:	00 
80103bd8:	c7 04 24 a0 00 00 00 	movl   $0xa0,(%esp)
80103bdf:	e8 d0 fe ff ff       	call   80103ab4 <outb>
  outb(IO_PIC2+1, T_IRQ0 + 8);      // ICW2
80103be4:	c7 44 24 04 28 00 00 	movl   $0x28,0x4(%esp)
80103beb:	00 
80103bec:	c7 04 24 a1 00 00 00 	movl   $0xa1,(%esp)
80103bf3:	e8 bc fe ff ff       	call   80103ab4 <outb>
  outb(IO_PIC2+1, IRQ_SLAVE);           // ICW3
80103bf8:	c7 44 24 04 02 00 00 	movl   $0x2,0x4(%esp)
80103bff:	00 
80103c00:	c7 04 24 a1 00 00 00 	movl   $0xa1,(%esp)
80103c07:	e8 a8 fe ff ff       	call   80103ab4 <outb>
  // NB Automatic EOI mode doesn't tend to work on the slave.
  // Linux source code says it's "to be investigated".
  outb(IO_PIC2+1, 0x3);                 // ICW4
80103c0c:	c7 44 24 04 03 00 00 	movl   $0x3,0x4(%esp)
80103c13:	00 
80103c14:	c7 04 24 a1 00 00 00 	movl   $0xa1,(%esp)
80103c1b:	e8 94 fe ff ff       	call   80103ab4 <outb>

  // OCW3:  0ef01prs
  //   ef:  0x = NOP, 10 = clear specific mask, 11 = set specific mask
  //    p:  0 = no polling, 1 = polling mode
  //   rs:  0x = NOP, 10 = read IRR, 11 = read ISR
  outb(IO_PIC1, 0x68);             // clear specific mask
80103c20:	c7 44 24 04 68 00 00 	movl   $0x68,0x4(%esp)
80103c27:	00 
80103c28:	c7 04 24 20 00 00 00 	movl   $0x20,(%esp)
80103c2f:	e8 80 fe ff ff       	call   80103ab4 <outb>
  outb(IO_PIC1, 0x0a);             // read IRR by default
80103c34:	c7 44 24 04 0a 00 00 	movl   $0xa,0x4(%esp)
80103c3b:	00 
80103c3c:	c7 04 24 20 00 00 00 	movl   $0x20,(%esp)
80103c43:	e8 6c fe ff ff       	call   80103ab4 <outb>

  outb(IO_PIC2, 0x68);             // OCW3
80103c48:	c7 44 24 04 68 00 00 	movl   $0x68,0x4(%esp)
80103c4f:	00 
80103c50:	c7 04 24 a0 00 00 00 	movl   $0xa0,(%esp)
80103c57:	e8 58 fe ff ff       	call   80103ab4 <outb>
  outb(IO_PIC2, 0x0a);             // OCW3
80103c5c:	c7 44 24 04 0a 00 00 	movl   $0xa,0x4(%esp)
80103c63:	00 
80103c64:	c7 04 24 a0 00 00 00 	movl   $0xa0,(%esp)
80103c6b:	e8 44 fe ff ff       	call   80103ab4 <outb>

  if(irqmask != 0xFFFF)
80103c70:	0f b7 05 00 b0 10 80 	movzwl 0x8010b000,%eax
80103c77:	66 83 f8 ff          	cmp    $0xffff,%ax
80103c7b:	74 12                	je     80103c8f <picinit+0x13d>
    picsetmask(irqmask);
80103c7d:	0f b7 05 00 b0 10 80 	movzwl 0x8010b000,%eax
80103c84:	0f b7 c0             	movzwl %ax,%eax
80103c87:	89 04 24             	mov    %eax,(%esp)
80103c8a:	e8 43 fe ff ff       	call   80103ad2 <picsetmask>
}
80103c8f:	c9                   	leave  
80103c90:	c3                   	ret    
80103c91:	66 90                	xchg   %ax,%ax
80103c93:	90                   	nop

80103c94 <pipealloc>:
  int writeopen;  // write fd is still open
};

int
pipealloc(struct file **f0, struct file **f1)
{
80103c94:	55                   	push   %ebp
80103c95:	89 e5                	mov    %esp,%ebp
80103c97:	83 ec 28             	sub    $0x28,%esp
  struct pipe *p;

  p = 0;
80103c9a:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
  *f0 = *f1 = 0;
80103ca1:	8b 45 0c             	mov    0xc(%ebp),%eax
80103ca4:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
80103caa:	8b 45 0c             	mov    0xc(%ebp),%eax
80103cad:	8b 10                	mov    (%eax),%edx
80103caf:	8b 45 08             	mov    0x8(%ebp),%eax
80103cb2:	89 10                	mov    %edx,(%eax)
  if((*f0 = filealloc()) == 0 || (*f1 = filealloc()) == 0)
80103cb4:	e8 8b d2 ff ff       	call   80100f44 <filealloc>
80103cb9:	8b 55 08             	mov    0x8(%ebp),%edx
80103cbc:	89 02                	mov    %eax,(%edx)
80103cbe:	8b 45 08             	mov    0x8(%ebp),%eax
80103cc1:	8b 00                	mov    (%eax),%eax
80103cc3:	85 c0                	test   %eax,%eax
80103cc5:	0f 84 c8 00 00 00    	je     80103d93 <pipealloc+0xff>
80103ccb:	e8 74 d2 ff ff       	call   80100f44 <filealloc>
80103cd0:	8b 55 0c             	mov    0xc(%ebp),%edx
80103cd3:	89 02                	mov    %eax,(%edx)
80103cd5:	8b 45 0c             	mov    0xc(%ebp),%eax
80103cd8:	8b 00                	mov    (%eax),%eax
80103cda:	85 c0                	test   %eax,%eax
80103cdc:	0f 84 b1 00 00 00    	je     80103d93 <pipealloc+0xff>
    goto bad;
  if((p = (struct pipe*)kalloc()) == 0)
80103ce2:	e8 64 ee ff ff       	call   80102b4b <kalloc>
80103ce7:	89 45 f4             	mov    %eax,-0xc(%ebp)
80103cea:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80103cee:	0f 84 9e 00 00 00    	je     80103d92 <pipealloc+0xfe>
    goto bad;
  p->readopen = 1;
80103cf4:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103cf7:	c7 80 3c 02 00 00 01 	movl   $0x1,0x23c(%eax)
80103cfe:	00 00 00 
  p->writeopen = 1;
80103d01:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103d04:	c7 80 40 02 00 00 01 	movl   $0x1,0x240(%eax)
80103d0b:	00 00 00 
  p->nwrite = 0;
80103d0e:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103d11:	c7 80 38 02 00 00 00 	movl   $0x0,0x238(%eax)
80103d18:	00 00 00 
  p->nread = 0;
80103d1b:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103d1e:	c7 80 34 02 00 00 00 	movl   $0x0,0x234(%eax)
80103d25:	00 00 00 
  initlock(&p->lock, "pipe");
80103d28:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103d2b:	c7 44 24 04 c0 89 10 	movl   $0x801089c0,0x4(%esp)
80103d32:	80 
80103d33:	89 04 24             	mov    %eax,(%esp)
80103d36:	e8 bb 12 00 00       	call   80104ff6 <initlock>
  (*f0)->type = FD_PIPE;
80103d3b:	8b 45 08             	mov    0x8(%ebp),%eax
80103d3e:	8b 00                	mov    (%eax),%eax
80103d40:	c7 00 01 00 00 00    	movl   $0x1,(%eax)
  (*f0)->readable = 1;
80103d46:	8b 45 08             	mov    0x8(%ebp),%eax
80103d49:	8b 00                	mov    (%eax),%eax
80103d4b:	c6 40 08 01          	movb   $0x1,0x8(%eax)
  (*f0)->writable = 0;
80103d4f:	8b 45 08             	mov    0x8(%ebp),%eax
80103d52:	8b 00                	mov    (%eax),%eax
80103d54:	c6 40 09 00          	movb   $0x0,0x9(%eax)
  (*f0)->pipe = p;
80103d58:	8b 45 08             	mov    0x8(%ebp),%eax
80103d5b:	8b 00                	mov    (%eax),%eax
80103d5d:	8b 55 f4             	mov    -0xc(%ebp),%edx
80103d60:	89 50 0c             	mov    %edx,0xc(%eax)
  (*f1)->type = FD_PIPE;
80103d63:	8b 45 0c             	mov    0xc(%ebp),%eax
80103d66:	8b 00                	mov    (%eax),%eax
80103d68:	c7 00 01 00 00 00    	movl   $0x1,(%eax)
  (*f1)->readable = 0;
80103d6e:	8b 45 0c             	mov    0xc(%ebp),%eax
80103d71:	8b 00                	mov    (%eax),%eax
80103d73:	c6 40 08 00          	movb   $0x0,0x8(%eax)
  (*f1)->writable = 1;
80103d77:	8b 45 0c             	mov    0xc(%ebp),%eax
80103d7a:	8b 00                	mov    (%eax),%eax
80103d7c:	c6 40 09 01          	movb   $0x1,0x9(%eax)
  (*f1)->pipe = p;
80103d80:	8b 45 0c             	mov    0xc(%ebp),%eax
80103d83:	8b 00                	mov    (%eax),%eax
80103d85:	8b 55 f4             	mov    -0xc(%ebp),%edx
80103d88:	89 50 0c             	mov    %edx,0xc(%eax)
  return 0;
80103d8b:	b8 00 00 00 00       	mov    $0x0,%eax
80103d90:	eb 43                	jmp    80103dd5 <pipealloc+0x141>
  p = 0;
  *f0 = *f1 = 0;
  if((*f0 = filealloc()) == 0 || (*f1 = filealloc()) == 0)
    goto bad;
  if((p = (struct pipe*)kalloc()) == 0)
    goto bad;
80103d92:	90                   	nop
  (*f1)->pipe = p;
  return 0;

//PAGEBREAK: 20
 bad:
  if(p)
80103d93:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80103d97:	74 0b                	je     80103da4 <pipealloc+0x110>
    kfree((char*)p);
80103d99:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103d9c:	89 04 24             	mov    %eax,(%esp)
80103d9f:	e8 0e ed ff ff       	call   80102ab2 <kfree>
  if(*f0)
80103da4:	8b 45 08             	mov    0x8(%ebp),%eax
80103da7:	8b 00                	mov    (%eax),%eax
80103da9:	85 c0                	test   %eax,%eax
80103dab:	74 0d                	je     80103dba <pipealloc+0x126>
    fileclose(*f0);
80103dad:	8b 45 08             	mov    0x8(%ebp),%eax
80103db0:	8b 00                	mov    (%eax),%eax
80103db2:	89 04 24             	mov    %eax,(%esp)
80103db5:	e8 32 d2 ff ff       	call   80100fec <fileclose>
  if(*f1)
80103dba:	8b 45 0c             	mov    0xc(%ebp),%eax
80103dbd:	8b 00                	mov    (%eax),%eax
80103dbf:	85 c0                	test   %eax,%eax
80103dc1:	74 0d                	je     80103dd0 <pipealloc+0x13c>
    fileclose(*f1);
80103dc3:	8b 45 0c             	mov    0xc(%ebp),%eax
80103dc6:	8b 00                	mov    (%eax),%eax
80103dc8:	89 04 24             	mov    %eax,(%esp)
80103dcb:	e8 1c d2 ff ff       	call   80100fec <fileclose>
  return -1;
80103dd0:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
}
80103dd5:	c9                   	leave  
80103dd6:	c3                   	ret    

80103dd7 <pipeclose>:

void
pipeclose(struct pipe *p, int writable)
{
80103dd7:	55                   	push   %ebp
80103dd8:	89 e5                	mov    %esp,%ebp
80103dda:	83 ec 18             	sub    $0x18,%esp
  acquire(&p->lock);
80103ddd:	8b 45 08             	mov    0x8(%ebp),%eax
80103de0:	89 04 24             	mov    %eax,(%esp)
80103de3:	e8 2f 12 00 00       	call   80105017 <acquire>
  if(writable){
80103de8:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
80103dec:	74 1f                	je     80103e0d <pipeclose+0x36>
    p->writeopen = 0;
80103dee:	8b 45 08             	mov    0x8(%ebp),%eax
80103df1:	c7 80 40 02 00 00 00 	movl   $0x0,0x240(%eax)
80103df8:	00 00 00 
    wakeup(&p->nread);
80103dfb:	8b 45 08             	mov    0x8(%ebp),%eax
80103dfe:	05 34 02 00 00       	add    $0x234,%eax
80103e03:	89 04 24             	mov    %eax,(%esp)
80103e06:	e8 13 0d 00 00       	call   80104b1e <wakeup>
80103e0b:	eb 1d                	jmp    80103e2a <pipeclose+0x53>
  } else {
    p->readopen = 0;
80103e0d:	8b 45 08             	mov    0x8(%ebp),%eax
80103e10:	c7 80 3c 02 00 00 00 	movl   $0x0,0x23c(%eax)
80103e17:	00 00 00 
    wakeup(&p->nwrite);
80103e1a:	8b 45 08             	mov    0x8(%ebp),%eax
80103e1d:	05 38 02 00 00       	add    $0x238,%eax
80103e22:	89 04 24             	mov    %eax,(%esp)
80103e25:	e8 f4 0c 00 00       	call   80104b1e <wakeup>
  }
  if(p->readopen == 0 && p->writeopen == 0){
80103e2a:	8b 45 08             	mov    0x8(%ebp),%eax
80103e2d:	8b 80 3c 02 00 00    	mov    0x23c(%eax),%eax
80103e33:	85 c0                	test   %eax,%eax
80103e35:	75 25                	jne    80103e5c <pipeclose+0x85>
80103e37:	8b 45 08             	mov    0x8(%ebp),%eax
80103e3a:	8b 80 40 02 00 00    	mov    0x240(%eax),%eax
80103e40:	85 c0                	test   %eax,%eax
80103e42:	75 18                	jne    80103e5c <pipeclose+0x85>
    release(&p->lock);
80103e44:	8b 45 08             	mov    0x8(%ebp),%eax
80103e47:	89 04 24             	mov    %eax,(%esp)
80103e4a:	e8 2a 12 00 00       	call   80105079 <release>
    kfree((char*)p);
80103e4f:	8b 45 08             	mov    0x8(%ebp),%eax
80103e52:	89 04 24             	mov    %eax,(%esp)
80103e55:	e8 58 ec ff ff       	call   80102ab2 <kfree>
80103e5a:	eb 0b                	jmp    80103e67 <pipeclose+0x90>
  } else
    release(&p->lock);
80103e5c:	8b 45 08             	mov    0x8(%ebp),%eax
80103e5f:	89 04 24             	mov    %eax,(%esp)
80103e62:	e8 12 12 00 00       	call   80105079 <release>
}
80103e67:	c9                   	leave  
80103e68:	c3                   	ret    

80103e69 <pipewrite>:

//PAGEBREAK: 40
int
pipewrite(struct pipe *p, char *addr, int n)
{
80103e69:	55                   	push   %ebp
80103e6a:	89 e5                	mov    %esp,%ebp
80103e6c:	53                   	push   %ebx
80103e6d:	83 ec 24             	sub    $0x24,%esp
  int i;

  acquire(&p->lock);
80103e70:	8b 45 08             	mov    0x8(%ebp),%eax
80103e73:	89 04 24             	mov    %eax,(%esp)
80103e76:	e8 9c 11 00 00       	call   80105017 <acquire>
  for(i = 0; i < n; i++){
80103e7b:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
80103e82:	e9 a8 00 00 00       	jmp    80103f2f <pipewrite+0xc6>
    while(p->nwrite == p->nread + PIPESIZE){  //DOC: pipewrite-full
      if(p->readopen == 0 || proc->killed){
80103e87:	8b 45 08             	mov    0x8(%ebp),%eax
80103e8a:	8b 80 3c 02 00 00    	mov    0x23c(%eax),%eax
80103e90:	85 c0                	test   %eax,%eax
80103e92:	74 0d                	je     80103ea1 <pipewrite+0x38>
80103e94:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80103e9a:	8b 40 24             	mov    0x24(%eax),%eax
80103e9d:	85 c0                	test   %eax,%eax
80103e9f:	74 15                	je     80103eb6 <pipewrite+0x4d>
        release(&p->lock);
80103ea1:	8b 45 08             	mov    0x8(%ebp),%eax
80103ea4:	89 04 24             	mov    %eax,(%esp)
80103ea7:	e8 cd 11 00 00       	call   80105079 <release>
        return -1;
80103eac:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80103eb1:	e9 9f 00 00 00       	jmp    80103f55 <pipewrite+0xec>
      }
      wakeup(&p->nread);
80103eb6:	8b 45 08             	mov    0x8(%ebp),%eax
80103eb9:	05 34 02 00 00       	add    $0x234,%eax
80103ebe:	89 04 24             	mov    %eax,(%esp)
80103ec1:	e8 58 0c 00 00       	call   80104b1e <wakeup>
      sleep(&p->nwrite, &p->lock);  //DOC: pipewrite-sleep
80103ec6:	8b 45 08             	mov    0x8(%ebp),%eax
80103ec9:	8b 55 08             	mov    0x8(%ebp),%edx
80103ecc:	81 c2 38 02 00 00    	add    $0x238,%edx
80103ed2:	89 44 24 04          	mov    %eax,0x4(%esp)
80103ed6:	89 14 24             	mov    %edx,(%esp)
80103ed9:	e8 64 0b 00 00       	call   80104a42 <sleep>
80103ede:	eb 01                	jmp    80103ee1 <pipewrite+0x78>
{
  int i;

  acquire(&p->lock);
  for(i = 0; i < n; i++){
    while(p->nwrite == p->nread + PIPESIZE){  //DOC: pipewrite-full
80103ee0:	90                   	nop
80103ee1:	8b 45 08             	mov    0x8(%ebp),%eax
80103ee4:	8b 90 38 02 00 00    	mov    0x238(%eax),%edx
80103eea:	8b 45 08             	mov    0x8(%ebp),%eax
80103eed:	8b 80 34 02 00 00    	mov    0x234(%eax),%eax
80103ef3:	05 00 02 00 00       	add    $0x200,%eax
80103ef8:	39 c2                	cmp    %eax,%edx
80103efa:	74 8b                	je     80103e87 <pipewrite+0x1e>
        return -1;
      }
      wakeup(&p->nread);
      sleep(&p->nwrite, &p->lock);  //DOC: pipewrite-sleep
    }
    p->data[p->nwrite++ % PIPESIZE] = addr[i];
80103efc:	8b 45 08             	mov    0x8(%ebp),%eax
80103eff:	8b 80 38 02 00 00    	mov    0x238(%eax),%eax
80103f05:	89 c3                	mov    %eax,%ebx
80103f07:	81 e3 ff 01 00 00    	and    $0x1ff,%ebx
80103f0d:	8b 4d f4             	mov    -0xc(%ebp),%ecx
80103f10:	8b 55 0c             	mov    0xc(%ebp),%edx
80103f13:	01 ca                	add    %ecx,%edx
80103f15:	0f b6 0a             	movzbl (%edx),%ecx
80103f18:	8b 55 08             	mov    0x8(%ebp),%edx
80103f1b:	88 4c 1a 34          	mov    %cl,0x34(%edx,%ebx,1)
80103f1f:	8d 50 01             	lea    0x1(%eax),%edx
80103f22:	8b 45 08             	mov    0x8(%ebp),%eax
80103f25:	89 90 38 02 00 00    	mov    %edx,0x238(%eax)
pipewrite(struct pipe *p, char *addr, int n)
{
  int i;

  acquire(&p->lock);
  for(i = 0; i < n; i++){
80103f2b:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
80103f2f:	8b 45 f4             	mov    -0xc(%ebp),%eax
80103f32:	3b 45 10             	cmp    0x10(%ebp),%eax
80103f35:	7c a9                	jl     80103ee0 <pipewrite+0x77>
      wakeup(&p->nread);
      sleep(&p->nwrite, &p->lock);  //DOC: pipewrite-sleep
    }
    p->data[p->nwrite++ % PIPESIZE] = addr[i];
  }
  wakeup(&p->nread);  //DOC: pipewrite-wakeup1
80103f37:	8b 45 08             	mov    0x8(%ebp),%eax
80103f3a:	05 34 02 00 00       	add    $0x234,%eax
80103f3f:	89 04 24             	mov    %eax,(%esp)
80103f42:	e8 d7 0b 00 00       	call   80104b1e <wakeup>
  release(&p->lock);
80103f47:	8b 45 08             	mov    0x8(%ebp),%eax
80103f4a:	89 04 24             	mov    %eax,(%esp)
80103f4d:	e8 27 11 00 00       	call   80105079 <release>
  return n;
80103f52:	8b 45 10             	mov    0x10(%ebp),%eax
}
80103f55:	83 c4 24             	add    $0x24,%esp
80103f58:	5b                   	pop    %ebx
80103f59:	5d                   	pop    %ebp
80103f5a:	c3                   	ret    

80103f5b <piperead>:

int
piperead(struct pipe *p, char *addr, int n)
{
80103f5b:	55                   	push   %ebp
80103f5c:	89 e5                	mov    %esp,%ebp
80103f5e:	53                   	push   %ebx
80103f5f:	83 ec 24             	sub    $0x24,%esp
  int i;

  acquire(&p->lock);
80103f62:	8b 45 08             	mov    0x8(%ebp),%eax
80103f65:	89 04 24             	mov    %eax,(%esp)
80103f68:	e8 aa 10 00 00       	call   80105017 <acquire>
  while(p->nread == p->nwrite && p->writeopen){  //DOC: pipe-empty
80103f6d:	eb 3a                	jmp    80103fa9 <piperead+0x4e>
    if(proc->killed){
80103f6f:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80103f75:	8b 40 24             	mov    0x24(%eax),%eax
80103f78:	85 c0                	test   %eax,%eax
80103f7a:	74 15                	je     80103f91 <piperead+0x36>
      release(&p->lock);
80103f7c:	8b 45 08             	mov    0x8(%ebp),%eax
80103f7f:	89 04 24             	mov    %eax,(%esp)
80103f82:	e8 f2 10 00 00       	call   80105079 <release>
      return -1;
80103f87:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80103f8c:	e9 b7 00 00 00       	jmp    80104048 <piperead+0xed>
    }
    sleep(&p->nread, &p->lock); //DOC: piperead-sleep
80103f91:	8b 45 08             	mov    0x8(%ebp),%eax
80103f94:	8b 55 08             	mov    0x8(%ebp),%edx
80103f97:	81 c2 34 02 00 00    	add    $0x234,%edx
80103f9d:	89 44 24 04          	mov    %eax,0x4(%esp)
80103fa1:	89 14 24             	mov    %edx,(%esp)
80103fa4:	e8 99 0a 00 00       	call   80104a42 <sleep>
piperead(struct pipe *p, char *addr, int n)
{
  int i;

  acquire(&p->lock);
  while(p->nread == p->nwrite && p->writeopen){  //DOC: pipe-empty
80103fa9:	8b 45 08             	mov    0x8(%ebp),%eax
80103fac:	8b 90 34 02 00 00    	mov    0x234(%eax),%edx
80103fb2:	8b 45 08             	mov    0x8(%ebp),%eax
80103fb5:	8b 80 38 02 00 00    	mov    0x238(%eax),%eax
80103fbb:	39 c2                	cmp    %eax,%edx
80103fbd:	75 0d                	jne    80103fcc <piperead+0x71>
80103fbf:	8b 45 08             	mov    0x8(%ebp),%eax
80103fc2:	8b 80 40 02 00 00    	mov    0x240(%eax),%eax
80103fc8:	85 c0                	test   %eax,%eax
80103fca:	75 a3                	jne    80103f6f <piperead+0x14>
      release(&p->lock);
      return -1;
    }
    sleep(&p->nread, &p->lock); //DOC: piperead-sleep
  }
  for(i = 0; i < n; i++){  //DOC: piperead-copy
80103fcc:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
80103fd3:	eb 4a                	jmp    8010401f <piperead+0xc4>
    if(p->nread == p->nwrite)
80103fd5:	8b 45 08             	mov    0x8(%ebp),%eax
80103fd8:	8b 90 34 02 00 00    	mov    0x234(%eax),%edx
80103fde:	8b 45 08             	mov    0x8(%ebp),%eax
80103fe1:	8b 80 38 02 00 00    	mov    0x238(%eax),%eax
80103fe7:	39 c2                	cmp    %eax,%edx
80103fe9:	74 3e                	je     80104029 <piperead+0xce>
      break;
    addr[i] = p->data[p->nread++ % PIPESIZE];
80103feb:	8b 55 f4             	mov    -0xc(%ebp),%edx
80103fee:	8b 45 0c             	mov    0xc(%ebp),%eax
80103ff1:	8d 0c 02             	lea    (%edx,%eax,1),%ecx
80103ff4:	8b 45 08             	mov    0x8(%ebp),%eax
80103ff7:	8b 80 34 02 00 00    	mov    0x234(%eax),%eax
80103ffd:	89 c3                	mov    %eax,%ebx
80103fff:	81 e3 ff 01 00 00    	and    $0x1ff,%ebx
80104005:	8b 55 08             	mov    0x8(%ebp),%edx
80104008:	0f b6 54 1a 34       	movzbl 0x34(%edx,%ebx,1),%edx
8010400d:	88 11                	mov    %dl,(%ecx)
8010400f:	8d 50 01             	lea    0x1(%eax),%edx
80104012:	8b 45 08             	mov    0x8(%ebp),%eax
80104015:	89 90 34 02 00 00    	mov    %edx,0x234(%eax)
      release(&p->lock);
      return -1;
    }
    sleep(&p->nread, &p->lock); //DOC: piperead-sleep
  }
  for(i = 0; i < n; i++){  //DOC: piperead-copy
8010401b:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
8010401f:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104022:	3b 45 10             	cmp    0x10(%ebp),%eax
80104025:	7c ae                	jl     80103fd5 <piperead+0x7a>
80104027:	eb 01                	jmp    8010402a <piperead+0xcf>
    if(p->nread == p->nwrite)
      break;
80104029:	90                   	nop
    addr[i] = p->data[p->nread++ % PIPESIZE];
  }
  wakeup(&p->nwrite);  //DOC: piperead-wakeup
8010402a:	8b 45 08             	mov    0x8(%ebp),%eax
8010402d:	05 38 02 00 00       	add    $0x238,%eax
80104032:	89 04 24             	mov    %eax,(%esp)
80104035:	e8 e4 0a 00 00       	call   80104b1e <wakeup>
  release(&p->lock);
8010403a:	8b 45 08             	mov    0x8(%ebp),%eax
8010403d:	89 04 24             	mov    %eax,(%esp)
80104040:	e8 34 10 00 00       	call   80105079 <release>
  return i;
80104045:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
80104048:	83 c4 24             	add    $0x24,%esp
8010404b:	5b                   	pop    %ebx
8010404c:	5d                   	pop    %ebp
8010404d:	c3                   	ret    
8010404e:	66 90                	xchg   %ax,%ax

80104050 <readeflags>:
  asm volatile("ltr %0" : : "r" (sel));
}

static inline uint
readeflags(void)
{
80104050:	55                   	push   %ebp
80104051:	89 e5                	mov    %esp,%ebp
80104053:	53                   	push   %ebx
80104054:	83 ec 10             	sub    $0x10,%esp
  uint eflags;
  asm volatile("pushfl; popl %0" : "=r" (eflags));
80104057:	9c                   	pushf  
80104058:	5b                   	pop    %ebx
80104059:	89 5d f8             	mov    %ebx,-0x8(%ebp)
  return eflags;
8010405c:	8b 45 f8             	mov    -0x8(%ebp),%eax
}
8010405f:	83 c4 10             	add    $0x10,%esp
80104062:	5b                   	pop    %ebx
80104063:	5d                   	pop    %ebp
80104064:	c3                   	ret    

80104065 <sti>:
  asm volatile("cli");
}

static inline void
sti(void)
{
80104065:	55                   	push   %ebp
80104066:	89 e5                	mov    %esp,%ebp
  asm volatile("sti");
80104068:	fb                   	sti    
}
80104069:	5d                   	pop    %ebp
8010406a:	c3                   	ret    

8010406b <pinit>:

static void wakeup1(void *chan);

void
pinit(void)
{
8010406b:	55                   	push   %ebp
8010406c:	89 e5                	mov    %esp,%ebp
8010406e:	83 ec 18             	sub    $0x18,%esp
  initlock(&ptable.lock, "ptable");
80104071:	c7 44 24 04 c8 89 10 	movl   $0x801089c8,0x4(%esp)
80104078:	80 
80104079:	c7 04 24 60 ff 10 80 	movl   $0x8010ff60,(%esp)
80104080:	e8 71 0f 00 00       	call   80104ff6 <initlock>
}
80104085:	c9                   	leave  
80104086:	c3                   	ret    

80104087 <allocproc>:
// If found, change state to EMBRYO and initialize
// state required to run in the kernel.
// Otherwise return 0.
static struct proc*
allocproc(void)
{
80104087:	55                   	push   %ebp
80104088:	89 e5                	mov    %esp,%ebp
8010408a:	83 ec 28             	sub    $0x28,%esp
  struct proc *p;
  char *sp;

  acquire(&ptable.lock);
8010408d:	c7 04 24 60 ff 10 80 	movl   $0x8010ff60,(%esp)
80104094:	e8 7e 0f 00 00       	call   80105017 <acquire>
  for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
80104099:	c7 45 f4 94 ff 10 80 	movl   $0x8010ff94,-0xc(%ebp)
801040a0:	eb 11                	jmp    801040b3 <allocproc+0x2c>
    if(p->state == UNUSED)
801040a2:	8b 45 f4             	mov    -0xc(%ebp),%eax
801040a5:	8b 40 0c             	mov    0xc(%eax),%eax
801040a8:	85 c0                	test   %eax,%eax
801040aa:	74 26                	je     801040d2 <allocproc+0x4b>
{
  struct proc *p;
  char *sp;

  acquire(&ptable.lock);
  for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
801040ac:	81 45 f4 04 01 00 00 	addl   $0x104,-0xc(%ebp)
801040b3:	81 7d f4 94 40 11 80 	cmpl   $0x80114094,-0xc(%ebp)
801040ba:	72 e6                	jb     801040a2 <allocproc+0x1b>
    if(p->state == UNUSED)
      goto found;
  release(&ptable.lock);
801040bc:	c7 04 24 60 ff 10 80 	movl   $0x8010ff60,(%esp)
801040c3:	e8 b1 0f 00 00       	call   80105079 <release>
  return 0;
801040c8:	b8 00 00 00 00       	mov    $0x0,%eax
801040cd:	e9 f2 00 00 00       	jmp    801041c4 <allocproc+0x13d>
  char *sp;

  acquire(&ptable.lock);
  for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
    if(p->state == UNUSED)
      goto found;
801040d2:	90                   	nop
  release(&ptable.lock);
  return 0;

found:
  p->state = EMBRYO;
801040d3:	8b 45 f4             	mov    -0xc(%ebp),%eax
801040d6:	c7 40 0c 01 00 00 00 	movl   $0x1,0xc(%eax)
  p->pid = nextpid++;
801040dd:	a1 04 b0 10 80       	mov    0x8010b004,%eax
801040e2:	8b 55 f4             	mov    -0xc(%ebp),%edx
801040e5:	89 42 10             	mov    %eax,0x10(%edx)
801040e8:	83 c0 01             	add    $0x1,%eax
801040eb:	a3 04 b0 10 80       	mov    %eax,0x8010b004
  release(&ptable.lock);
801040f0:	c7 04 24 60 ff 10 80 	movl   $0x8010ff60,(%esp)
801040f7:	e8 7d 0f 00 00       	call   80105079 <release>

  // Allocate kernel stack.
  if((p->kstack = kalloc()) == 0){
801040fc:	e8 4a ea ff ff       	call   80102b4b <kalloc>
80104101:	8b 55 f4             	mov    -0xc(%ebp),%edx
80104104:	89 42 08             	mov    %eax,0x8(%edx)
80104107:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010410a:	8b 40 08             	mov    0x8(%eax),%eax
8010410d:	85 c0                	test   %eax,%eax
8010410f:	75 14                	jne    80104125 <allocproc+0x9e>
    p->state = UNUSED;
80104111:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104114:	c7 40 0c 00 00 00 00 	movl   $0x0,0xc(%eax)
    return 0;
8010411b:	b8 00 00 00 00       	mov    $0x0,%eax
80104120:	e9 9f 00 00 00       	jmp    801041c4 <allocproc+0x13d>
  }
  sp = p->kstack + KSTACKSIZE;
80104125:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104128:	8b 40 08             	mov    0x8(%eax),%eax
8010412b:	05 00 10 00 00       	add    $0x1000,%eax
80104130:	89 45 ec             	mov    %eax,-0x14(%ebp)
  
  // Leave room for trap frame.
  sp -= sizeof *p->tf;
80104133:	83 6d ec 4c          	subl   $0x4c,-0x14(%ebp)
  p->tf = (struct trapframe*)sp;
80104137:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010413a:	8b 55 ec             	mov    -0x14(%ebp),%edx
8010413d:	89 50 18             	mov    %edx,0x18(%eax)
  
  // Set up new context to start executing at forkret,
  // which returns to trapret.
  sp -= 4;
80104140:	83 6d ec 04          	subl   $0x4,-0x14(%ebp)
  *(uint*)sp = (uint)trapret;
80104144:	ba 88 67 10 80       	mov    $0x80106788,%edx
80104149:	8b 45 ec             	mov    -0x14(%ebp),%eax
8010414c:	89 10                	mov    %edx,(%eax)

  sp -= sizeof *p->context;
8010414e:	83 6d ec 14          	subl   $0x14,-0x14(%ebp)
  p->context = (struct context*)sp;
80104152:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104155:	8b 55 ec             	mov    -0x14(%ebp),%edx
80104158:	89 50 1c             	mov    %edx,0x1c(%eax)
  memset(p->context, 0, sizeof *p->context);
8010415b:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010415e:	8b 40 1c             	mov    0x1c(%eax),%eax
80104161:	c7 44 24 08 14 00 00 	movl   $0x14,0x8(%esp)
80104168:	00 
80104169:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
80104170:	00 
80104171:	89 04 24             	mov    %eax,(%esp)
80104174:	e8 f9 10 00 00       	call   80105272 <memset>
  p->context->eip = (uint)forkret;
80104179:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010417c:	8b 40 1c             	mov    0x1c(%eax),%eax
8010417f:	ba 16 4a 10 80       	mov    $0x80104a16,%edx
80104184:	89 50 10             	mov    %edx,0x10(%eax)

  /** OUR ADDITION - 1.1
        Initialize the array of pointers to signal handler functions
        to be the default signal handler, and initialize pending to  0 **/
  int i;
  for (i=0; i<NUMSIG; i++)
80104187:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
8010418e:	eb 14                	jmp    801041a4 <allocproc+0x11d>
	  p->handlers[i]=defaultHandler;
80104190:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104193:	8b 55 f0             	mov    -0x10(%ebp),%edx
80104196:	83 c2 20             	add    $0x20,%edx
80104199:	c7 04 90 c0 4c 10 80 	movl   $0x80104cc0,(%eax,%edx,4)

  /** OUR ADDITION - 1.1
        Initialize the array of pointers to signal handler functions
        to be the default signal handler, and initialize pending to  0 **/
  int i;
  for (i=0; i<NUMSIG; i++)
801041a0:	83 45 f0 01          	addl   $0x1,-0x10(%ebp)
801041a4:	83 7d f0 1f          	cmpl   $0x1f,-0x10(%ebp)
801041a8:	7e e6                	jle    80104190 <allocproc+0x109>
	  p->handlers[i]=defaultHandler;
  p->pending=0;
801041aa:	8b 45 f4             	mov    -0xc(%ebp),%eax
801041ad:	c7 40 7c 00 00 00 00 	movl   $0x0,0x7c(%eax)

  /** OUR ADDITION - 1.6
          Initialize number of ticks to -1 **/
  p->num_ticks=-1;
801041b4:	8b 45 f4             	mov    -0xc(%ebp),%eax
801041b7:	c7 80 00 01 00 00 ff 	movl   $0xffffffff,0x100(%eax)
801041be:	ff ff ff 


  return p;
801041c1:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
801041c4:	c9                   	leave  
801041c5:	c3                   	ret    

801041c6 <userinit>:

//PAGEBREAK: 32
// Set up first user process.
void
userinit(void)
{
801041c6:	55                   	push   %ebp
801041c7:	89 e5                	mov    %esp,%ebp
801041c9:	83 ec 28             	sub    $0x28,%esp
  struct proc *p;
  extern char _binary_initcode_start[], _binary_initcode_size[];
  
  p = allocproc();
801041cc:	e8 b6 fe ff ff       	call   80104087 <allocproc>
801041d1:	89 45 f4             	mov    %eax,-0xc(%ebp)
  initproc = p;
801041d4:	8b 45 f4             	mov    -0xc(%ebp),%eax
801041d7:	a3 88 b6 10 80       	mov    %eax,0x8010b688
  if((p->pgdir = setupkvm(kalloc)) == 0)
801041dc:	c7 04 24 4b 2b 10 80 	movl   $0x80102b4b,(%esp)
801041e3:	e8 b7 3c 00 00       	call   80107e9f <setupkvm>
801041e8:	8b 55 f4             	mov    -0xc(%ebp),%edx
801041eb:	89 42 04             	mov    %eax,0x4(%edx)
801041ee:	8b 45 f4             	mov    -0xc(%ebp),%eax
801041f1:	8b 40 04             	mov    0x4(%eax),%eax
801041f4:	85 c0                	test   %eax,%eax
801041f6:	75 0c                	jne    80104204 <userinit+0x3e>
    panic("userinit: out of memory?");
801041f8:	c7 04 24 cf 89 10 80 	movl   $0x801089cf,(%esp)
801041ff:	e8 42 c3 ff ff       	call   80100546 <panic>
  inituvm(p->pgdir, _binary_initcode_start, (int)_binary_initcode_size);
80104204:	ba 2c 00 00 00       	mov    $0x2c,%edx
80104209:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010420c:	8b 40 04             	mov    0x4(%eax),%eax
8010420f:	89 54 24 08          	mov    %edx,0x8(%esp)
80104213:	c7 44 24 04 20 b5 10 	movl   $0x8010b520,0x4(%esp)
8010421a:	80 
8010421b:	89 04 24             	mov    %eax,(%esp)
8010421e:	e8 d4 3e 00 00       	call   801080f7 <inituvm>
  p->sz = PGSIZE;
80104223:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104226:	c7 00 00 10 00 00    	movl   $0x1000,(%eax)
  memset(p->tf, 0, sizeof(*p->tf));
8010422c:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010422f:	8b 40 18             	mov    0x18(%eax),%eax
80104232:	c7 44 24 08 4c 00 00 	movl   $0x4c,0x8(%esp)
80104239:	00 
8010423a:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
80104241:	00 
80104242:	89 04 24             	mov    %eax,(%esp)
80104245:	e8 28 10 00 00       	call   80105272 <memset>
  p->tf->cs = (SEG_UCODE << 3) | DPL_USER;
8010424a:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010424d:	8b 40 18             	mov    0x18(%eax),%eax
80104250:	66 c7 40 3c 23 00    	movw   $0x23,0x3c(%eax)
  p->tf->ds = (SEG_UDATA << 3) | DPL_USER;
80104256:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104259:	8b 40 18             	mov    0x18(%eax),%eax
8010425c:	66 c7 40 2c 2b 00    	movw   $0x2b,0x2c(%eax)
  p->tf->es = p->tf->ds;
80104262:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104265:	8b 40 18             	mov    0x18(%eax),%eax
80104268:	8b 55 f4             	mov    -0xc(%ebp),%edx
8010426b:	8b 52 18             	mov    0x18(%edx),%edx
8010426e:	0f b7 52 2c          	movzwl 0x2c(%edx),%edx
80104272:	66 89 50 28          	mov    %dx,0x28(%eax)
  p->tf->ss = p->tf->ds;
80104276:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104279:	8b 40 18             	mov    0x18(%eax),%eax
8010427c:	8b 55 f4             	mov    -0xc(%ebp),%edx
8010427f:	8b 52 18             	mov    0x18(%edx),%edx
80104282:	0f b7 52 2c          	movzwl 0x2c(%edx),%edx
80104286:	66 89 50 48          	mov    %dx,0x48(%eax)
  p->tf->eflags = FL_IF;
8010428a:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010428d:	8b 40 18             	mov    0x18(%eax),%eax
80104290:	c7 40 40 00 02 00 00 	movl   $0x200,0x40(%eax)
  p->tf->esp = PGSIZE;
80104297:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010429a:	8b 40 18             	mov    0x18(%eax),%eax
8010429d:	c7 40 44 00 10 00 00 	movl   $0x1000,0x44(%eax)
  p->tf->eip = 0;  // beginning of initcode.S
801042a4:	8b 45 f4             	mov    -0xc(%ebp),%eax
801042a7:	8b 40 18             	mov    0x18(%eax),%eax
801042aa:	c7 40 38 00 00 00 00 	movl   $0x0,0x38(%eax)

  safestrcpy(p->name, "initcode", sizeof(p->name));
801042b1:	8b 45 f4             	mov    -0xc(%ebp),%eax
801042b4:	83 c0 6c             	add    $0x6c,%eax
801042b7:	c7 44 24 08 10 00 00 	movl   $0x10,0x8(%esp)
801042be:	00 
801042bf:	c7 44 24 04 e8 89 10 	movl   $0x801089e8,0x4(%esp)
801042c6:	80 
801042c7:	89 04 24             	mov    %eax,(%esp)
801042ca:	e8 d3 11 00 00       	call   801054a2 <safestrcpy>
  p->cwd = namei("/");
801042cf:	c7 04 24 f1 89 10 80 	movl   $0x801089f1,(%esp)
801042d6:	e8 7a e1 ff ff       	call   80102455 <namei>
801042db:	8b 55 f4             	mov    -0xc(%ebp),%edx
801042de:	89 42 68             	mov    %eax,0x68(%edx)

  p->state = RUNNABLE;
801042e1:	8b 45 f4             	mov    -0xc(%ebp),%eax
801042e4:	c7 40 0c 03 00 00 00 	movl   $0x3,0xc(%eax)
}
801042eb:	c9                   	leave  
801042ec:	c3                   	ret    

801042ed <growproc>:

// Grow current process's memory by n bytes.
// Return 0 on success, -1 on failure.
int
growproc(int n)
{
801042ed:	55                   	push   %ebp
801042ee:	89 e5                	mov    %esp,%ebp
801042f0:	83 ec 28             	sub    $0x28,%esp
  uint sz;
  
  sz = proc->sz;
801042f3:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801042f9:	8b 00                	mov    (%eax),%eax
801042fb:	89 45 f4             	mov    %eax,-0xc(%ebp)
  if(n > 0){
801042fe:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
80104302:	7e 34                	jle    80104338 <growproc+0x4b>
    if((sz = allocuvm(proc->pgdir, sz, sz + n)) == 0)
80104304:	8b 55 08             	mov    0x8(%ebp),%edx
80104307:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010430a:	01 c2                	add    %eax,%edx
8010430c:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80104312:	8b 40 04             	mov    0x4(%eax),%eax
80104315:	89 54 24 08          	mov    %edx,0x8(%esp)
80104319:	8b 55 f4             	mov    -0xc(%ebp),%edx
8010431c:	89 54 24 04          	mov    %edx,0x4(%esp)
80104320:	89 04 24             	mov    %eax,(%esp)
80104323:	e8 49 3f 00 00       	call   80108271 <allocuvm>
80104328:	89 45 f4             	mov    %eax,-0xc(%ebp)
8010432b:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
8010432f:	75 41                	jne    80104372 <growproc+0x85>
      return -1;
80104331:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80104336:	eb 58                	jmp    80104390 <growproc+0xa3>
  } else if(n < 0){
80104338:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
8010433c:	79 34                	jns    80104372 <growproc+0x85>
    if((sz = deallocuvm(proc->pgdir, sz, sz + n)) == 0)
8010433e:	8b 55 08             	mov    0x8(%ebp),%edx
80104341:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104344:	01 c2                	add    %eax,%edx
80104346:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
8010434c:	8b 40 04             	mov    0x4(%eax),%eax
8010434f:	89 54 24 08          	mov    %edx,0x8(%esp)
80104353:	8b 55 f4             	mov    -0xc(%ebp),%edx
80104356:	89 54 24 04          	mov    %edx,0x4(%esp)
8010435a:	89 04 24             	mov    %eax,(%esp)
8010435d:	e8 e9 3f 00 00       	call   8010834b <deallocuvm>
80104362:	89 45 f4             	mov    %eax,-0xc(%ebp)
80104365:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80104369:	75 07                	jne    80104372 <growproc+0x85>
      return -1;
8010436b:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80104370:	eb 1e                	jmp    80104390 <growproc+0xa3>
  }
  proc->sz = sz;
80104372:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80104378:	8b 55 f4             	mov    -0xc(%ebp),%edx
8010437b:	89 10                	mov    %edx,(%eax)
  switchuvm(proc);
8010437d:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80104383:	89 04 24             	mov    %eax,(%esp)
80104386:	e8 05 3c 00 00       	call   80107f90 <switchuvm>
  return 0;
8010438b:	b8 00 00 00 00       	mov    $0x0,%eax
}
80104390:	c9                   	leave  
80104391:	c3                   	ret    

80104392 <fork>:
// Create a new process copying p as the parent.
// Sets up stack to return as if from system call.
// Caller must set state of returned proc to RUNNABLE.
int
fork(void)
{
80104392:	55                   	push   %ebp
80104393:	89 e5                	mov    %esp,%ebp
80104395:	57                   	push   %edi
80104396:	56                   	push   %esi
80104397:	53                   	push   %ebx
80104398:	83 ec 2c             	sub    $0x2c,%esp
  int i, pid;
  struct proc *np;

  // Allocate process.
  if((np = allocproc()) == 0)
8010439b:	e8 e7 fc ff ff       	call   80104087 <allocproc>
801043a0:	89 45 e0             	mov    %eax,-0x20(%ebp)
801043a3:	83 7d e0 00          	cmpl   $0x0,-0x20(%ebp)
801043a7:	75 0a                	jne    801043b3 <fork+0x21>
    return -1;
801043a9:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
801043ae:	e9 77 01 00 00       	jmp    8010452a <fork+0x198>

  // Copy process state from p.
  if((np->pgdir = copyuvm(proc->pgdir, proc->sz)) == 0){
801043b3:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801043b9:	8b 10                	mov    (%eax),%edx
801043bb:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801043c1:	8b 40 04             	mov    0x4(%eax),%eax
801043c4:	89 54 24 04          	mov    %edx,0x4(%esp)
801043c8:	89 04 24             	mov    %eax,(%esp)
801043cb:	e8 17 41 00 00       	call   801084e7 <copyuvm>
801043d0:	8b 55 e0             	mov    -0x20(%ebp),%edx
801043d3:	89 42 04             	mov    %eax,0x4(%edx)
801043d6:	8b 45 e0             	mov    -0x20(%ebp),%eax
801043d9:	8b 40 04             	mov    0x4(%eax),%eax
801043dc:	85 c0                	test   %eax,%eax
801043de:	75 2c                	jne    8010440c <fork+0x7a>
    kfree(np->kstack);
801043e0:	8b 45 e0             	mov    -0x20(%ebp),%eax
801043e3:	8b 40 08             	mov    0x8(%eax),%eax
801043e6:	89 04 24             	mov    %eax,(%esp)
801043e9:	e8 c4 e6 ff ff       	call   80102ab2 <kfree>
    np->kstack = 0;
801043ee:	8b 45 e0             	mov    -0x20(%ebp),%eax
801043f1:	c7 40 08 00 00 00 00 	movl   $0x0,0x8(%eax)
    np->state = UNUSED;
801043f8:	8b 45 e0             	mov    -0x20(%ebp),%eax
801043fb:	c7 40 0c 00 00 00 00 	movl   $0x0,0xc(%eax)
    return -1;
80104402:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80104407:	e9 1e 01 00 00       	jmp    8010452a <fork+0x198>
  }
  np->sz = proc->sz;
8010440c:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80104412:	8b 10                	mov    (%eax),%edx
80104414:	8b 45 e0             	mov    -0x20(%ebp),%eax
80104417:	89 10                	mov    %edx,(%eax)
  np->parent = proc;
80104419:	65 8b 15 04 00 00 00 	mov    %gs:0x4,%edx
80104420:	8b 45 e0             	mov    -0x20(%ebp),%eax
80104423:	89 50 14             	mov    %edx,0x14(%eax)
  *np->tf = *proc->tf;
80104426:	8b 45 e0             	mov    -0x20(%ebp),%eax
80104429:	8b 50 18             	mov    0x18(%eax),%edx
8010442c:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80104432:	8b 40 18             	mov    0x18(%eax),%eax
80104435:	89 c3                	mov    %eax,%ebx
80104437:	b8 13 00 00 00       	mov    $0x13,%eax
8010443c:	89 d7                	mov    %edx,%edi
8010443e:	89 de                	mov    %ebx,%esi
80104440:	89 c1                	mov    %eax,%ecx
80104442:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)


  // Clear %eax so that fork returns 0 in the child.
  np->tf->eax = 0;
80104444:	8b 45 e0             	mov    -0x20(%ebp),%eax
80104447:	8b 40 18             	mov    0x18(%eax),%eax
8010444a:	c7 40 1c 00 00 00 00 	movl   $0x0,0x1c(%eax)

  for(i = 0; i < NOFILE; i++)
80104451:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)
80104458:	eb 3d                	jmp    80104497 <fork+0x105>
    if(proc->ofile[i])
8010445a:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80104460:	8b 55 e4             	mov    -0x1c(%ebp),%edx
80104463:	83 c2 08             	add    $0x8,%edx
80104466:	8b 44 90 08          	mov    0x8(%eax,%edx,4),%eax
8010446a:	85 c0                	test   %eax,%eax
8010446c:	74 25                	je     80104493 <fork+0x101>
      np->ofile[i] = filedup(proc->ofile[i]);
8010446e:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80104474:	8b 55 e4             	mov    -0x1c(%ebp),%edx
80104477:	83 c2 08             	add    $0x8,%edx
8010447a:	8b 44 90 08          	mov    0x8(%eax,%edx,4),%eax
8010447e:	89 04 24             	mov    %eax,(%esp)
80104481:	e8 1e cb ff ff       	call   80100fa4 <filedup>
80104486:	8b 55 e0             	mov    -0x20(%ebp),%edx
80104489:	8b 4d e4             	mov    -0x1c(%ebp),%ecx
8010448c:	83 c1 08             	add    $0x8,%ecx
8010448f:	89 44 8a 08          	mov    %eax,0x8(%edx,%ecx,4)


  // Clear %eax so that fork returns 0 in the child.
  np->tf->eax = 0;

  for(i = 0; i < NOFILE; i++)
80104493:	83 45 e4 01          	addl   $0x1,-0x1c(%ebp)
80104497:	83 7d e4 0f          	cmpl   $0xf,-0x1c(%ebp)
8010449b:	7e bd                	jle    8010445a <fork+0xc8>
    if(proc->ofile[i])
      np->ofile[i] = filedup(proc->ofile[i]);
  np->cwd = idup(proc->cwd);
8010449d:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801044a3:	8b 40 68             	mov    0x68(%eax),%eax
801044a6:	89 04 24             	mov    %eax,(%esp)
801044a9:	e8 b4 d3 ff ff       	call   80101862 <idup>
801044ae:	8b 55 e0             	mov    -0x20(%ebp),%edx
801044b1:	89 42 68             	mov    %eax,0x68(%edx)
 
  /** OUR ADDITION - 1.5 **/
  for(i=0;i<NUMSIG;i++)  // copy the parent's registered signal handlers
801044b4:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)
801044bb:	eb 1f                	jmp    801044dc <fork+0x14a>
         np->handlers[i] = proc->handlers[i];
801044bd:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801044c3:	8b 55 e4             	mov    -0x1c(%ebp),%edx
801044c6:	83 c2 20             	add    $0x20,%edx
801044c9:	8b 14 90             	mov    (%eax,%edx,4),%edx
801044cc:	8b 45 e0             	mov    -0x20(%ebp),%eax
801044cf:	8b 4d e4             	mov    -0x1c(%ebp),%ecx
801044d2:	83 c1 20             	add    $0x20,%ecx
801044d5:	89 14 88             	mov    %edx,(%eax,%ecx,4)
    if(proc->ofile[i])
      np->ofile[i] = filedup(proc->ofile[i]);
  np->cwd = idup(proc->cwd);
 
  /** OUR ADDITION - 1.5 **/
  for(i=0;i<NUMSIG;i++)  // copy the parent's registered signal handlers
801044d8:	83 45 e4 01          	addl   $0x1,-0x1c(%ebp)
801044dc:	83 7d e4 1f          	cmpl   $0x1f,-0x1c(%ebp)
801044e0:	7e db                	jle    801044bd <fork+0x12b>
         np->handlers[i] = proc->handlers[i];
  np->pending = proc->pending;
801044e2:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801044e8:	8b 50 7c             	mov    0x7c(%eax),%edx
801044eb:	8b 45 e0             	mov    -0x20(%ebp),%eax
801044ee:	89 50 7c             	mov    %edx,0x7c(%eax)
  pid = np->pid;
801044f1:	8b 45 e0             	mov    -0x20(%ebp),%eax
801044f4:	8b 40 10             	mov    0x10(%eax),%eax
801044f7:	89 45 dc             	mov    %eax,-0x24(%ebp)
  np->state = RUNNABLE;
801044fa:	8b 45 e0             	mov    -0x20(%ebp),%eax
801044fd:	c7 40 0c 03 00 00 00 	movl   $0x3,0xc(%eax)
  safestrcpy(np->name, proc->name, sizeof(proc->name));
80104504:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
8010450a:	8d 50 6c             	lea    0x6c(%eax),%edx
8010450d:	8b 45 e0             	mov    -0x20(%ebp),%eax
80104510:	83 c0 6c             	add    $0x6c,%eax
80104513:	c7 44 24 08 10 00 00 	movl   $0x10,0x8(%esp)
8010451a:	00 
8010451b:	89 54 24 04          	mov    %edx,0x4(%esp)
8010451f:	89 04 24             	mov    %eax,(%esp)
80104522:	e8 7b 0f 00 00       	call   801054a2 <safestrcpy>
  return pid;
80104527:	8b 45 dc             	mov    -0x24(%ebp),%eax
}
8010452a:	83 c4 2c             	add    $0x2c,%esp
8010452d:	5b                   	pop    %ebx
8010452e:	5e                   	pop    %esi
8010452f:	5f                   	pop    %edi
80104530:	5d                   	pop    %ebp
80104531:	c3                   	ret    

80104532 <exit>:
// Exit the current process.  Does not return.
// An exited process remains in the zombie state
// until its parent calls wait() to find out it exited.
void
exit(void)
{
80104532:	55                   	push   %ebp
80104533:	89 e5                	mov    %esp,%ebp
80104535:	83 ec 28             	sub    $0x28,%esp
  struct proc *p;
  int fd;

  if(proc == initproc)
80104538:	65 8b 15 04 00 00 00 	mov    %gs:0x4,%edx
8010453f:	a1 88 b6 10 80       	mov    0x8010b688,%eax
80104544:	39 c2                	cmp    %eax,%edx
80104546:	75 0c                	jne    80104554 <exit+0x22>
    panic("init exiting");
80104548:	c7 04 24 f3 89 10 80 	movl   $0x801089f3,(%esp)
8010454f:	e8 f2 bf ff ff       	call   80100546 <panic>

  // Close all open files.
  for(fd = 0; fd < NOFILE; fd++){
80104554:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
8010455b:	eb 44                	jmp    801045a1 <exit+0x6f>
    if(proc->ofile[fd]){
8010455d:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80104563:	8b 55 f0             	mov    -0x10(%ebp),%edx
80104566:	83 c2 08             	add    $0x8,%edx
80104569:	8b 44 90 08          	mov    0x8(%eax,%edx,4),%eax
8010456d:	85 c0                	test   %eax,%eax
8010456f:	74 2c                	je     8010459d <exit+0x6b>
      fileclose(proc->ofile[fd]);
80104571:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80104577:	8b 55 f0             	mov    -0x10(%ebp),%edx
8010457a:	83 c2 08             	add    $0x8,%edx
8010457d:	8b 44 90 08          	mov    0x8(%eax,%edx,4),%eax
80104581:	89 04 24             	mov    %eax,(%esp)
80104584:	e8 63 ca ff ff       	call   80100fec <fileclose>
      proc->ofile[fd] = 0;
80104589:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
8010458f:	8b 55 f0             	mov    -0x10(%ebp),%edx
80104592:	83 c2 08             	add    $0x8,%edx
80104595:	c7 44 90 08 00 00 00 	movl   $0x0,0x8(%eax,%edx,4)
8010459c:	00 

  if(proc == initproc)
    panic("init exiting");

  // Close all open files.
  for(fd = 0; fd < NOFILE; fd++){
8010459d:	83 45 f0 01          	addl   $0x1,-0x10(%ebp)
801045a1:	83 7d f0 0f          	cmpl   $0xf,-0x10(%ebp)
801045a5:	7e b6                	jle    8010455d <exit+0x2b>
      fileclose(proc->ofile[fd]);
      proc->ofile[fd] = 0;
    }
  }

  iput(proc->cwd);
801045a7:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801045ad:	8b 40 68             	mov    0x68(%eax),%eax
801045b0:	89 04 24             	mov    %eax,(%esp)
801045b3:	e8 8f d4 ff ff       	call   80101a47 <iput>
  proc->cwd = 0;
801045b8:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801045be:	c7 40 68 00 00 00 00 	movl   $0x0,0x68(%eax)

  acquire(&ptable.lock);
801045c5:	c7 04 24 60 ff 10 80 	movl   $0x8010ff60,(%esp)
801045cc:	e8 46 0a 00 00       	call   80105017 <acquire>

  // Parent might be sleeping in wait().
  wakeup1(proc->parent);
801045d1:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801045d7:	8b 40 14             	mov    0x14(%eax),%eax
801045da:	89 04 24             	mov    %eax,(%esp)
801045dd:	e8 fb 04 00 00       	call   80104add <wakeup1>

  // Pass abandoned children to init.
  for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
801045e2:	c7 45 f4 94 ff 10 80 	movl   $0x8010ff94,-0xc(%ebp)
801045e9:	eb 3b                	jmp    80104626 <exit+0xf4>
    if(p->parent == proc){
801045eb:	8b 45 f4             	mov    -0xc(%ebp),%eax
801045ee:	8b 50 14             	mov    0x14(%eax),%edx
801045f1:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801045f7:	39 c2                	cmp    %eax,%edx
801045f9:	75 24                	jne    8010461f <exit+0xed>
      p->parent = initproc;
801045fb:	8b 15 88 b6 10 80    	mov    0x8010b688,%edx
80104601:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104604:	89 50 14             	mov    %edx,0x14(%eax)
      if(p->state == ZOMBIE)
80104607:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010460a:	8b 40 0c             	mov    0xc(%eax),%eax
8010460d:	83 f8 05             	cmp    $0x5,%eax
80104610:	75 0d                	jne    8010461f <exit+0xed>
        wakeup1(initproc);
80104612:	a1 88 b6 10 80       	mov    0x8010b688,%eax
80104617:	89 04 24             	mov    %eax,(%esp)
8010461a:	e8 be 04 00 00       	call   80104add <wakeup1>

  // Parent might be sleeping in wait().
  wakeup1(proc->parent);

  // Pass abandoned children to init.
  for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
8010461f:	81 45 f4 04 01 00 00 	addl   $0x104,-0xc(%ebp)
80104626:	81 7d f4 94 40 11 80 	cmpl   $0x80114094,-0xc(%ebp)
8010462d:	72 bc                	jb     801045eb <exit+0xb9>
        wakeup1(initproc);
    }
  }

  // Jump into the scheduler, never to return.
  proc->state = ZOMBIE;
8010462f:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80104635:	c7 40 0c 05 00 00 00 	movl   $0x5,0xc(%eax)
  sched();
8010463c:	e8 f1 02 00 00       	call   80104932 <sched>
  panic("zombie exit");
80104641:	c7 04 24 00 8a 10 80 	movl   $0x80108a00,(%esp)
80104648:	e8 f9 be ff ff       	call   80100546 <panic>

8010464d <wait>:

// Wait for a child process to exit and return its pid.
// Return -1 if this process has no children.
int
wait(void)
{
8010464d:	55                   	push   %ebp
8010464e:	89 e5                	mov    %esp,%ebp
80104650:	83 ec 28             	sub    $0x28,%esp
  struct proc *p;
  int havekids, pid;

  acquire(&ptable.lock);
80104653:	c7 04 24 60 ff 10 80 	movl   $0x8010ff60,(%esp)
8010465a:	e8 b8 09 00 00       	call   80105017 <acquire>
  for(;;){
    // Scan through table looking for zombie children.
    havekids = 0;
8010465f:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
    for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80104666:	c7 45 f4 94 ff 10 80 	movl   $0x8010ff94,-0xc(%ebp)
8010466d:	e9 9d 00 00 00       	jmp    8010470f <wait+0xc2>
      if(p->parent != proc)
80104672:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104675:	8b 50 14             	mov    0x14(%eax),%edx
80104678:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
8010467e:	39 c2                	cmp    %eax,%edx
80104680:	0f 85 81 00 00 00    	jne    80104707 <wait+0xba>
        continue;
      havekids = 1;
80104686:	c7 45 f0 01 00 00 00 	movl   $0x1,-0x10(%ebp)
      if(p->state == ZOMBIE){
8010468d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104690:	8b 40 0c             	mov    0xc(%eax),%eax
80104693:	83 f8 05             	cmp    $0x5,%eax
80104696:	75 70                	jne    80104708 <wait+0xbb>
        // Found one.
        pid = p->pid;
80104698:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010469b:	8b 40 10             	mov    0x10(%eax),%eax
8010469e:	89 45 ec             	mov    %eax,-0x14(%ebp)
        kfree(p->kstack);
801046a1:	8b 45 f4             	mov    -0xc(%ebp),%eax
801046a4:	8b 40 08             	mov    0x8(%eax),%eax
801046a7:	89 04 24             	mov    %eax,(%esp)
801046aa:	e8 03 e4 ff ff       	call   80102ab2 <kfree>
        p->kstack = 0;
801046af:	8b 45 f4             	mov    -0xc(%ebp),%eax
801046b2:	c7 40 08 00 00 00 00 	movl   $0x0,0x8(%eax)
        freevm(p->pgdir);
801046b9:	8b 45 f4             	mov    -0xc(%ebp),%eax
801046bc:	8b 40 04             	mov    0x4(%eax),%eax
801046bf:	89 04 24             	mov    %eax,(%esp)
801046c2:	e8 40 3d 00 00       	call   80108407 <freevm>
        p->state = UNUSED;
801046c7:	8b 45 f4             	mov    -0xc(%ebp),%eax
801046ca:	c7 40 0c 00 00 00 00 	movl   $0x0,0xc(%eax)
        p->pid = 0;
801046d1:	8b 45 f4             	mov    -0xc(%ebp),%eax
801046d4:	c7 40 10 00 00 00 00 	movl   $0x0,0x10(%eax)
        p->parent = 0;
801046db:	8b 45 f4             	mov    -0xc(%ebp),%eax
801046de:	c7 40 14 00 00 00 00 	movl   $0x0,0x14(%eax)
        p->name[0] = 0;
801046e5:	8b 45 f4             	mov    -0xc(%ebp),%eax
801046e8:	c6 40 6c 00          	movb   $0x0,0x6c(%eax)
        p->killed = 0;
801046ec:	8b 45 f4             	mov    -0xc(%ebp),%eax
801046ef:	c7 40 24 00 00 00 00 	movl   $0x0,0x24(%eax)
        release(&ptable.lock);
801046f6:	c7 04 24 60 ff 10 80 	movl   $0x8010ff60,(%esp)
801046fd:	e8 77 09 00 00       	call   80105079 <release>
        return pid;
80104702:	8b 45 ec             	mov    -0x14(%ebp),%eax
80104705:	eb 56                	jmp    8010475d <wait+0x110>
  for(;;){
    // Scan through table looking for zombie children.
    havekids = 0;
    for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
      if(p->parent != proc)
        continue;
80104707:	90                   	nop

  acquire(&ptable.lock);
  for(;;){
    // Scan through table looking for zombie children.
    havekids = 0;
    for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80104708:	81 45 f4 04 01 00 00 	addl   $0x104,-0xc(%ebp)
8010470f:	81 7d f4 94 40 11 80 	cmpl   $0x80114094,-0xc(%ebp)
80104716:	0f 82 56 ff ff ff    	jb     80104672 <wait+0x25>
        return pid;
      }
    }

    // No point waiting if we don't have any children.
    if(!havekids || proc->killed){
8010471c:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
80104720:	74 0d                	je     8010472f <wait+0xe2>
80104722:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80104728:	8b 40 24             	mov    0x24(%eax),%eax
8010472b:	85 c0                	test   %eax,%eax
8010472d:	74 13                	je     80104742 <wait+0xf5>
      release(&ptable.lock);
8010472f:	c7 04 24 60 ff 10 80 	movl   $0x8010ff60,(%esp)
80104736:	e8 3e 09 00 00       	call   80105079 <release>
      return -1;
8010473b:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80104740:	eb 1b                	jmp    8010475d <wait+0x110>
    }

    // Wait for children to exit.  (See wakeup1 call in proc_exit.)
    sleep(proc, &ptable.lock);  //DOC: wait-sleep
80104742:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80104748:	c7 44 24 04 60 ff 10 	movl   $0x8010ff60,0x4(%esp)
8010474f:	80 
80104750:	89 04 24             	mov    %eax,(%esp)
80104753:	e8 ea 02 00 00       	call   80104a42 <sleep>
  }
80104758:	e9 02 ff ff ff       	jmp    8010465f <wait+0x12>
}
8010475d:	c9                   	leave  
8010475e:	c3                   	ret    

8010475f <register_handler>:

void
register_handler(sighandler_t sighandler)
{
8010475f:	55                   	push   %ebp
80104760:	89 e5                	mov    %esp,%ebp
80104762:	83 ec 28             	sub    $0x28,%esp
  char* addr = uva2ka(proc->pgdir, (char*)proc->tf->esp);
80104765:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
8010476b:	8b 40 18             	mov    0x18(%eax),%eax
8010476e:	8b 40 44             	mov    0x44(%eax),%eax
80104771:	89 c2                	mov    %eax,%edx
80104773:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80104779:	8b 40 04             	mov    0x4(%eax),%eax
8010477c:	89 54 24 04          	mov    %edx,0x4(%esp)
80104780:	89 04 24             	mov    %eax,(%esp)
80104783:	e8 70 3e 00 00       	call   801085f8 <uva2ka>
80104788:	89 45 f4             	mov    %eax,-0xc(%ebp)
  if ((proc->tf->esp & 0xFFF) == 0)
8010478b:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80104791:	8b 40 18             	mov    0x18(%eax),%eax
80104794:	8b 40 44             	mov    0x44(%eax),%eax
80104797:	25 ff 0f 00 00       	and    $0xfff,%eax
8010479c:	85 c0                	test   %eax,%eax
8010479e:	75 0c                	jne    801047ac <register_handler+0x4d>
    panic("esp_offset == 0");
801047a0:	c7 04 24 0c 8a 10 80 	movl   $0x80108a0c,(%esp)
801047a7:	e8 9a bd ff ff       	call   80100546 <panic>

    /* open a new frame */
  *(int*)(addr + ((proc->tf->esp - 4) & 0xFFF))
801047ac:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801047b2:	8b 40 18             	mov    0x18(%eax),%eax
801047b5:	8b 40 44             	mov    0x44(%eax),%eax
801047b8:	83 e8 04             	sub    $0x4,%eax
801047bb:	89 c2                	mov    %eax,%edx
801047bd:	81 e2 ff 0f 00 00    	and    $0xfff,%edx
801047c3:	8b 45 f4             	mov    -0xc(%ebp),%eax
801047c6:	01 c2                	add    %eax,%edx
          = proc->tf->eip;
801047c8:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801047ce:	8b 40 18             	mov    0x18(%eax),%eax
801047d1:	8b 40 38             	mov    0x38(%eax),%eax
801047d4:	89 02                	mov    %eax,(%edx)
  proc->tf->esp -= 4;
801047d6:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801047dc:	8b 40 18             	mov    0x18(%eax),%eax
801047df:	65 8b 15 04 00 00 00 	mov    %gs:0x4,%edx
801047e6:	8b 52 18             	mov    0x18(%edx),%edx
801047e9:	8b 52 44             	mov    0x44(%edx),%edx
801047ec:	83 ea 04             	sub    $0x4,%edx
801047ef:	89 50 44             	mov    %edx,0x44(%eax)

    /* update eip */
  proc->tf->eip = (uint)sighandler;
801047f2:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801047f8:	8b 40 18             	mov    0x18(%eax),%eax
801047fb:	8b 55 08             	mov    0x8(%ebp),%edx
801047fe:	89 50 38             	mov    %edx,0x38(%eax)
}
80104801:	c9                   	leave  
80104802:	c3                   	ret    

80104803 <scheduler>:
//  - swtch to start running that process
//  - eventually that process transfers control
//      via swtch back to the scheduler.
void
scheduler(void)
{
80104803:	55                   	push   %ebp
80104804:	89 e5                	mov    %esp,%ebp
80104806:	56                   	push   %esi
80104807:	53                   	push   %ebx
80104808:	83 ec 20             	sub    $0x20,%esp
  struct proc *p;

  for(;;){
    // Enable interrupts on this processor.
    sti();
8010480b:	e8 55 f8 ff ff       	call   80104065 <sti>

    // Loop over process table looking for process to run.
    acquire(&ptable.lock);
80104810:	c7 04 24 60 ff 10 80 	movl   $0x8010ff60,(%esp)
80104817:	e8 fb 07 00 00       	call   80105017 <acquire>
    for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
8010481c:	c7 45 f4 94 ff 10 80 	movl   $0x8010ff94,-0xc(%ebp)
80104823:	e9 ec 00 00 00       	jmp    80104914 <scheduler+0x111>
      if(p->state != RUNNABLE)
80104828:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010482b:	8b 40 0c             	mov    0xc(%eax),%eax
8010482e:	83 f8 03             	cmp    $0x3,%eax
80104831:	0f 85 d5 00 00 00    	jne    8010490c <scheduler+0x109>
        continue;

      // Switch to chosen process.  It is the process's job
      // to release ptable.lock and then reacquire it
      // before jumping back to us.
      proc = p;
80104837:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010483a:	65 a3 04 00 00 00    	mov    %eax,%gs:0x4
      switchuvm(p);
80104840:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104843:	89 04 24             	mov    %eax,(%esp)
80104846:	e8 45 37 00 00       	call   80107f90 <switchuvm>
      p->state = RUNNING;
8010484b:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010484e:	c7 40 0c 04 00 00 00 	movl   $0x4,0xc(%eax)

      //task 1.4
      if(p->pending){ //if there is at least one pending signal
80104855:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104858:	8b 40 7c             	mov    0x7c(%eax),%eax
8010485b:	85 c0                	test   %eax,%eax
8010485d:	74 7c                	je     801048db <scheduler+0xd8>
    	  int bit=0;
8010485f:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
    	  while (bit<NUMSIG)
80104866:	eb 6d                	jmp    801048d5 <scheduler+0xd2>
    	  {
    		if (p->pending & 1<<bit){ //signal number bit+1 is on
80104868:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010486b:	8b 50 7c             	mov    0x7c(%eax),%edx
8010486e:	8b 45 f0             	mov    -0x10(%ebp),%eax
80104871:	bb 01 00 00 00       	mov    $0x1,%ebx
80104876:	89 de                	mov    %ebx,%esi
80104878:	89 c1                	mov    %eax,%ecx
8010487a:	d3 e6                	shl    %cl,%esi
8010487c:	89 f0                	mov    %esi,%eax
8010487e:	21 d0                	and    %edx,%eax
80104880:	85 c0                	test   %eax,%eax
80104882:	74 4d                	je     801048d1 <scheduler+0xce>

    			sighandler_t signalHandler = p->handlers[bit+1];
80104884:	8b 45 f0             	mov    -0x10(%ebp),%eax
80104887:	8d 50 01             	lea    0x1(%eax),%edx
8010488a:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010488d:	83 c2 20             	add    $0x20,%edx
80104890:	8b 04 90             	mov    (%eax,%edx,4),%eax
80104893:	89 45 ec             	mov    %eax,-0x14(%ebp)

    			/* defaultHandler is defined in kernel and therefore can't be
    			   called from userspace*/

    			if (signalHandler == defaultHandler)
80104896:	81 7d ec c0 4c 10 80 	cmpl   $0x80104cc0,-0x14(%ebp)
8010489d:	75 07                	jne    801048a6 <scheduler+0xa3>
    				defaultHandler();
8010489f:	e8 1c 04 00 00       	call   80104cc0 <defaultHandler>
801048a4:	eb 0b                	jmp    801048b1 <scheduler+0xae>
    			else
    				register_handler(signalHandler);
801048a6:	8b 45 ec             	mov    -0x14(%ebp),%eax
801048a9:	89 04 24             	mov    %eax,(%esp)
801048ac:	e8 ae fe ff ff       	call   8010475f <register_handler>
    			p->pending-= 1<<bit; //change the bit back to 0
801048b1:	8b 45 f4             	mov    -0xc(%ebp),%eax
801048b4:	8b 50 7c             	mov    0x7c(%eax),%edx
801048b7:	8b 45 f0             	mov    -0x10(%ebp),%eax
801048ba:	bb 01 00 00 00       	mov    $0x1,%ebx
801048bf:	89 de                	mov    %ebx,%esi
801048c1:	89 c1                	mov    %eax,%ecx
801048c3:	d3 e6                	shl    %cl,%esi
801048c5:	89 f0                	mov    %esi,%eax
801048c7:	29 c2                	sub    %eax,%edx
801048c9:	8b 45 f4             	mov    -0xc(%ebp),%eax
801048cc:	89 50 7c             	mov    %edx,0x7c(%eax)
    			break;
801048cf:	eb 0a                	jmp    801048db <scheduler+0xd8>
    		}
    		bit++;
801048d1:	83 45 f0 01          	addl   $0x1,-0x10(%ebp)
      p->state = RUNNING;

      //task 1.4
      if(p->pending){ //if there is at least one pending signal
    	  int bit=0;
    	  while (bit<NUMSIG)
801048d5:	83 7d f0 1f          	cmpl   $0x1f,-0x10(%ebp)
801048d9:	7e 8d                	jle    80104868 <scheduler+0x65>
    		}
    		bit++;
    	  }
      }

      swtch(&cpu->scheduler, proc->context);
801048db:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801048e1:	8b 40 1c             	mov    0x1c(%eax),%eax
801048e4:	65 8b 15 00 00 00 00 	mov    %gs:0x0,%edx
801048eb:	83 c2 04             	add    $0x4,%edx
801048ee:	89 44 24 04          	mov    %eax,0x4(%esp)
801048f2:	89 14 24             	mov    %edx,(%esp)
801048f5:	e8 1e 0c 00 00       	call   80105518 <swtch>
      switchkvm();
801048fa:	e8 74 36 00 00       	call   80107f73 <switchkvm>

      // Process is done running for now.
      // It should have changed its p->state before coming back.
      proc = 0;
801048ff:	65 c7 05 04 00 00 00 	movl   $0x0,%gs:0x4
80104906:	00 00 00 00 
8010490a:	eb 01                	jmp    8010490d <scheduler+0x10a>

    // Loop over process table looking for process to run.
    acquire(&ptable.lock);
    for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
      if(p->state != RUNNABLE)
        continue;
8010490c:	90                   	nop
    // Enable interrupts on this processor.
    sti();

    // Loop over process table looking for process to run.
    acquire(&ptable.lock);
    for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
8010490d:	81 45 f4 04 01 00 00 	addl   $0x104,-0xc(%ebp)
80104914:	81 7d f4 94 40 11 80 	cmpl   $0x80114094,-0xc(%ebp)
8010491b:	0f 82 07 ff ff ff    	jb     80104828 <scheduler+0x25>

      // Process is done running for now.
      // It should have changed its p->state before coming back.
      proc = 0;
    }
    release(&ptable.lock);
80104921:	c7 04 24 60 ff 10 80 	movl   $0x8010ff60,(%esp)
80104928:	e8 4c 07 00 00       	call   80105079 <release>

  }
8010492d:	e9 d9 fe ff ff       	jmp    8010480b <scheduler+0x8>

80104932 <sched>:

// Enter scheduler.  Must hold only ptable.lock
// and have changed proc->state.
void
sched(void)
{
80104932:	55                   	push   %ebp
80104933:	89 e5                	mov    %esp,%ebp
80104935:	83 ec 28             	sub    $0x28,%esp
  int intena;

  if(!holding(&ptable.lock))
80104938:	c7 04 24 60 ff 10 80 	movl   $0x8010ff60,(%esp)
8010493f:	e8 fd 07 00 00       	call   80105141 <holding>
80104944:	85 c0                	test   %eax,%eax
80104946:	75 0c                	jne    80104954 <sched+0x22>
    panic("sched ptable.lock");
80104948:	c7 04 24 1c 8a 10 80 	movl   $0x80108a1c,(%esp)
8010494f:	e8 f2 bb ff ff       	call   80100546 <panic>
  if(cpu->ncli != 1)
80104954:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
8010495a:	8b 80 ac 00 00 00    	mov    0xac(%eax),%eax
80104960:	83 f8 01             	cmp    $0x1,%eax
80104963:	74 0c                	je     80104971 <sched+0x3f>
    panic("sched locks");
80104965:	c7 04 24 2e 8a 10 80 	movl   $0x80108a2e,(%esp)
8010496c:	e8 d5 bb ff ff       	call   80100546 <panic>
  if(proc->state == RUNNING)
80104971:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80104977:	8b 40 0c             	mov    0xc(%eax),%eax
8010497a:	83 f8 04             	cmp    $0x4,%eax
8010497d:	75 0c                	jne    8010498b <sched+0x59>
    panic("sched running");
8010497f:	c7 04 24 3a 8a 10 80 	movl   $0x80108a3a,(%esp)
80104986:	e8 bb bb ff ff       	call   80100546 <panic>
  if(readeflags()&FL_IF)
8010498b:	e8 c0 f6 ff ff       	call   80104050 <readeflags>
80104990:	25 00 02 00 00       	and    $0x200,%eax
80104995:	85 c0                	test   %eax,%eax
80104997:	74 0c                	je     801049a5 <sched+0x73>
    panic("sched interruptible");
80104999:	c7 04 24 48 8a 10 80 	movl   $0x80108a48,(%esp)
801049a0:	e8 a1 bb ff ff       	call   80100546 <panic>
  intena = cpu->intena;
801049a5:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
801049ab:	8b 80 b0 00 00 00    	mov    0xb0(%eax),%eax
801049b1:	89 45 f4             	mov    %eax,-0xc(%ebp)
  swtch(&proc->context, cpu->scheduler);
801049b4:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
801049ba:	8b 40 04             	mov    0x4(%eax),%eax
801049bd:	65 8b 15 04 00 00 00 	mov    %gs:0x4,%edx
801049c4:	83 c2 1c             	add    $0x1c,%edx
801049c7:	89 44 24 04          	mov    %eax,0x4(%esp)
801049cb:	89 14 24             	mov    %edx,(%esp)
801049ce:	e8 45 0b 00 00       	call   80105518 <swtch>
  cpu->intena = intena;
801049d3:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
801049d9:	8b 55 f4             	mov    -0xc(%ebp),%edx
801049dc:	89 90 b0 00 00 00    	mov    %edx,0xb0(%eax)
}
801049e2:	c9                   	leave  
801049e3:	c3                   	ret    

801049e4 <yield>:

// Give up the CPU for one scheduling round.
void
yield(void)
{
801049e4:	55                   	push   %ebp
801049e5:	89 e5                	mov    %esp,%ebp
801049e7:	83 ec 18             	sub    $0x18,%esp
  acquire(&ptable.lock);  //DOC: yieldlock
801049ea:	c7 04 24 60 ff 10 80 	movl   $0x8010ff60,(%esp)
801049f1:	e8 21 06 00 00       	call   80105017 <acquire>
  proc->state = RUNNABLE;
801049f6:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801049fc:	c7 40 0c 03 00 00 00 	movl   $0x3,0xc(%eax)
  sched();
80104a03:	e8 2a ff ff ff       	call   80104932 <sched>
  release(&ptable.lock);
80104a08:	c7 04 24 60 ff 10 80 	movl   $0x8010ff60,(%esp)
80104a0f:	e8 65 06 00 00       	call   80105079 <release>
}
80104a14:	c9                   	leave  
80104a15:	c3                   	ret    

80104a16 <forkret>:

// A fork child's very first scheduling by scheduler()
// will swtch here.  "Return" to user space.
void
forkret(void)
{
80104a16:	55                   	push   %ebp
80104a17:	89 e5                	mov    %esp,%ebp
80104a19:	83 ec 18             	sub    $0x18,%esp
  static int first = 1;
  // Still holding ptable.lock from scheduler.
  release(&ptable.lock);
80104a1c:	c7 04 24 60 ff 10 80 	movl   $0x8010ff60,(%esp)
80104a23:	e8 51 06 00 00       	call   80105079 <release>

  if (first) {
80104a28:	a1 20 b0 10 80       	mov    0x8010b020,%eax
80104a2d:	85 c0                	test   %eax,%eax
80104a2f:	74 0f                	je     80104a40 <forkret+0x2a>
    // Some initialization functions must be run in the context
    // of a regular process (e.g., they call sleep), and thus cannot 
    // be run from main().
    first = 0;
80104a31:	c7 05 20 b0 10 80 00 	movl   $0x0,0x8010b020
80104a38:	00 00 00 
    initlog();
80104a3b:	e8 20 e6 ff ff       	call   80103060 <initlog>
  }
  
  // Return to "caller", actually trapret (see allocproc).
}
80104a40:	c9                   	leave  
80104a41:	c3                   	ret    

80104a42 <sleep>:

// Atomically release lock and sleep on chan.
// Reacquires lock when awakened.
void
sleep(void *chan, struct spinlock *lk)
{
80104a42:	55                   	push   %ebp
80104a43:	89 e5                	mov    %esp,%ebp
80104a45:	83 ec 18             	sub    $0x18,%esp
  if(proc == 0)
80104a48:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80104a4e:	85 c0                	test   %eax,%eax
80104a50:	75 0c                	jne    80104a5e <sleep+0x1c>
    panic("sleep");
80104a52:	c7 04 24 5c 8a 10 80 	movl   $0x80108a5c,(%esp)
80104a59:	e8 e8 ba ff ff       	call   80100546 <panic>

  if(lk == 0)
80104a5e:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
80104a62:	75 0c                	jne    80104a70 <sleep+0x2e>
    panic("sleep without lk");
80104a64:	c7 04 24 62 8a 10 80 	movl   $0x80108a62,(%esp)
80104a6b:	e8 d6 ba ff ff       	call   80100546 <panic>
  // change p->state and then call sched.
  // Once we hold ptable.lock, we can be
  // guaranteed that we won't miss any wakeup
  // (wakeup runs with ptable.lock locked),
  // so it's okay to release lk.
  if(lk != &ptable.lock){  //DOC: sleeplock0
80104a70:	81 7d 0c 60 ff 10 80 	cmpl   $0x8010ff60,0xc(%ebp)
80104a77:	74 17                	je     80104a90 <sleep+0x4e>
    acquire(&ptable.lock);  //DOC: sleeplock1
80104a79:	c7 04 24 60 ff 10 80 	movl   $0x8010ff60,(%esp)
80104a80:	e8 92 05 00 00       	call   80105017 <acquire>
    release(lk);
80104a85:	8b 45 0c             	mov    0xc(%ebp),%eax
80104a88:	89 04 24             	mov    %eax,(%esp)
80104a8b:	e8 e9 05 00 00       	call   80105079 <release>
  }

  // Go to sleep.
  proc->chan = chan;
80104a90:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80104a96:	8b 55 08             	mov    0x8(%ebp),%edx
80104a99:	89 50 20             	mov    %edx,0x20(%eax)
  proc->state = SLEEPING;
80104a9c:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80104aa2:	c7 40 0c 02 00 00 00 	movl   $0x2,0xc(%eax)
  sched();
80104aa9:	e8 84 fe ff ff       	call   80104932 <sched>

  // Tidy up.
  proc->chan = 0;
80104aae:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80104ab4:	c7 40 20 00 00 00 00 	movl   $0x0,0x20(%eax)

  // Reacquire original lock.
  if(lk != &ptable.lock){  //DOC: sleeplock2
80104abb:	81 7d 0c 60 ff 10 80 	cmpl   $0x8010ff60,0xc(%ebp)
80104ac2:	74 17                	je     80104adb <sleep+0x99>
    release(&ptable.lock);
80104ac4:	c7 04 24 60 ff 10 80 	movl   $0x8010ff60,(%esp)
80104acb:	e8 a9 05 00 00       	call   80105079 <release>
    acquire(lk);
80104ad0:	8b 45 0c             	mov    0xc(%ebp),%eax
80104ad3:	89 04 24             	mov    %eax,(%esp)
80104ad6:	e8 3c 05 00 00       	call   80105017 <acquire>
  }
}
80104adb:	c9                   	leave  
80104adc:	c3                   	ret    

80104add <wakeup1>:
//PAGEBREAK!
// Wake up all processes sleeping on chan.
// The ptable lock must be held.
static void
wakeup1(void *chan)
{
80104add:	55                   	push   %ebp
80104ade:	89 e5                	mov    %esp,%ebp
80104ae0:	83 ec 10             	sub    $0x10,%esp
  struct proc *p;

  for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
80104ae3:	c7 45 fc 94 ff 10 80 	movl   $0x8010ff94,-0x4(%ebp)
80104aea:	eb 27                	jmp    80104b13 <wakeup1+0x36>
    if(p->state == SLEEPING && p->chan == chan)
80104aec:	8b 45 fc             	mov    -0x4(%ebp),%eax
80104aef:	8b 40 0c             	mov    0xc(%eax),%eax
80104af2:	83 f8 02             	cmp    $0x2,%eax
80104af5:	75 15                	jne    80104b0c <wakeup1+0x2f>
80104af7:	8b 45 fc             	mov    -0x4(%ebp),%eax
80104afa:	8b 40 20             	mov    0x20(%eax),%eax
80104afd:	3b 45 08             	cmp    0x8(%ebp),%eax
80104b00:	75 0a                	jne    80104b0c <wakeup1+0x2f>
      p->state = RUNNABLE;
80104b02:	8b 45 fc             	mov    -0x4(%ebp),%eax
80104b05:	c7 40 0c 03 00 00 00 	movl   $0x3,0xc(%eax)
static void
wakeup1(void *chan)
{
  struct proc *p;

  for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
80104b0c:	81 45 fc 04 01 00 00 	addl   $0x104,-0x4(%ebp)
80104b13:	81 7d fc 94 40 11 80 	cmpl   $0x80114094,-0x4(%ebp)
80104b1a:	72 d0                	jb     80104aec <wakeup1+0xf>
    if(p->state == SLEEPING && p->chan == chan)
      p->state = RUNNABLE;
}
80104b1c:	c9                   	leave  
80104b1d:	c3                   	ret    

80104b1e <wakeup>:

// Wake up all processes sleeping on chan.
void
wakeup(void *chan)
{
80104b1e:	55                   	push   %ebp
80104b1f:	89 e5                	mov    %esp,%ebp
80104b21:	83 ec 18             	sub    $0x18,%esp
  acquire(&ptable.lock);
80104b24:	c7 04 24 60 ff 10 80 	movl   $0x8010ff60,(%esp)
80104b2b:	e8 e7 04 00 00       	call   80105017 <acquire>
  wakeup1(chan);
80104b30:	8b 45 08             	mov    0x8(%ebp),%eax
80104b33:	89 04 24             	mov    %eax,(%esp)
80104b36:	e8 a2 ff ff ff       	call   80104add <wakeup1>
  release(&ptable.lock);
80104b3b:	c7 04 24 60 ff 10 80 	movl   $0x8010ff60,(%esp)
80104b42:	e8 32 05 00 00       	call   80105079 <release>
}
80104b47:	c9                   	leave  
80104b48:	c3                   	ret    

80104b49 <kill>:
// Kill the process with the given pid.
// Process won't exit until it returns
// to user space (see trap in trap.c).
int
kill(int pid)
{
80104b49:	55                   	push   %ebp
80104b4a:	89 e5                	mov    %esp,%ebp
80104b4c:	83 ec 28             	sub    $0x28,%esp
  struct proc *p;

  acquire(&ptable.lock);
80104b4f:	c7 04 24 60 ff 10 80 	movl   $0x8010ff60,(%esp)
80104b56:	e8 bc 04 00 00       	call   80105017 <acquire>
  for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80104b5b:	c7 45 f4 94 ff 10 80 	movl   $0x8010ff94,-0xc(%ebp)
80104b62:	eb 44                	jmp    80104ba8 <kill+0x5f>
    if(p->pid == pid){
80104b64:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104b67:	8b 40 10             	mov    0x10(%eax),%eax
80104b6a:	3b 45 08             	cmp    0x8(%ebp),%eax
80104b6d:	75 32                	jne    80104ba1 <kill+0x58>
      p->killed = 1;
80104b6f:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104b72:	c7 40 24 01 00 00 00 	movl   $0x1,0x24(%eax)
      // Wake process from sleep if necessary.
      if(p->state == SLEEPING)
80104b79:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104b7c:	8b 40 0c             	mov    0xc(%eax),%eax
80104b7f:	83 f8 02             	cmp    $0x2,%eax
80104b82:	75 0a                	jne    80104b8e <kill+0x45>
        p->state = RUNNABLE;
80104b84:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104b87:	c7 40 0c 03 00 00 00 	movl   $0x3,0xc(%eax)
      release(&ptable.lock);
80104b8e:	c7 04 24 60 ff 10 80 	movl   $0x8010ff60,(%esp)
80104b95:	e8 df 04 00 00       	call   80105079 <release>
      return 0;
80104b9a:	b8 00 00 00 00       	mov    $0x0,%eax
80104b9f:	eb 21                	jmp    80104bc2 <kill+0x79>
kill(int pid)
{
  struct proc *p;

  acquire(&ptable.lock);
  for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80104ba1:	81 45 f4 04 01 00 00 	addl   $0x104,-0xc(%ebp)
80104ba8:	81 7d f4 94 40 11 80 	cmpl   $0x80114094,-0xc(%ebp)
80104baf:	72 b3                	jb     80104b64 <kill+0x1b>
        p->state = RUNNABLE;
      release(&ptable.lock);
      return 0;
    }
  }
  release(&ptable.lock);
80104bb1:	c7 04 24 60 ff 10 80 	movl   $0x8010ff60,(%esp)
80104bb8:	e8 bc 04 00 00       	call   80105079 <release>
  return -1;
80104bbd:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
}
80104bc2:	c9                   	leave  
80104bc3:	c3                   	ret    

80104bc4 <procdump>:
// Print a process listing to console.  For debugging.
// Runs when user types ^P on console.
// No lock to avoid wedging a stuck machine further.
void
procdump(void)
{
80104bc4:	55                   	push   %ebp
80104bc5:	89 e5                	mov    %esp,%ebp
80104bc7:	83 ec 58             	sub    $0x58,%esp
  int i;
  struct proc *p;
  char *state;
  uint pc[10];
  
  for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80104bca:	c7 45 f0 94 ff 10 80 	movl   $0x8010ff94,-0x10(%ebp)
80104bd1:	e9 db 00 00 00       	jmp    80104cb1 <procdump+0xed>
    if(p->state == UNUSED)
80104bd6:	8b 45 f0             	mov    -0x10(%ebp),%eax
80104bd9:	8b 40 0c             	mov    0xc(%eax),%eax
80104bdc:	85 c0                	test   %eax,%eax
80104bde:	0f 84 c5 00 00 00    	je     80104ca9 <procdump+0xe5>
      continue;
    if(p->state >= 0 && p->state < NELEM(states) && states[p->state])
80104be4:	8b 45 f0             	mov    -0x10(%ebp),%eax
80104be7:	8b 40 0c             	mov    0xc(%eax),%eax
80104bea:	83 f8 05             	cmp    $0x5,%eax
80104bed:	77 23                	ja     80104c12 <procdump+0x4e>
80104bef:	8b 45 f0             	mov    -0x10(%ebp),%eax
80104bf2:	8b 40 0c             	mov    0xc(%eax),%eax
80104bf5:	8b 04 85 08 b0 10 80 	mov    -0x7fef4ff8(,%eax,4),%eax
80104bfc:	85 c0                	test   %eax,%eax
80104bfe:	74 12                	je     80104c12 <procdump+0x4e>
      state = states[p->state];
80104c00:	8b 45 f0             	mov    -0x10(%ebp),%eax
80104c03:	8b 40 0c             	mov    0xc(%eax),%eax
80104c06:	8b 04 85 08 b0 10 80 	mov    -0x7fef4ff8(,%eax,4),%eax
80104c0d:	89 45 ec             	mov    %eax,-0x14(%ebp)
80104c10:	eb 07                	jmp    80104c19 <procdump+0x55>
    else
      state = "???";
80104c12:	c7 45 ec 73 8a 10 80 	movl   $0x80108a73,-0x14(%ebp)
    cprintf("%d %s %s", p->pid, state, p->name);
80104c19:	8b 45 f0             	mov    -0x10(%ebp),%eax
80104c1c:	8d 50 6c             	lea    0x6c(%eax),%edx
80104c1f:	8b 45 f0             	mov    -0x10(%ebp),%eax
80104c22:	8b 40 10             	mov    0x10(%eax),%eax
80104c25:	89 54 24 0c          	mov    %edx,0xc(%esp)
80104c29:	8b 55 ec             	mov    -0x14(%ebp),%edx
80104c2c:	89 54 24 08          	mov    %edx,0x8(%esp)
80104c30:	89 44 24 04          	mov    %eax,0x4(%esp)
80104c34:	c7 04 24 77 8a 10 80 	movl   $0x80108a77,(%esp)
80104c3b:	e8 6a b7 ff ff       	call   801003aa <cprintf>
    if(p->state == SLEEPING){
80104c40:	8b 45 f0             	mov    -0x10(%ebp),%eax
80104c43:	8b 40 0c             	mov    0xc(%eax),%eax
80104c46:	83 f8 02             	cmp    $0x2,%eax
80104c49:	75 50                	jne    80104c9b <procdump+0xd7>
      getcallerpcs((uint*)p->context->ebp+2, pc);
80104c4b:	8b 45 f0             	mov    -0x10(%ebp),%eax
80104c4e:	8b 40 1c             	mov    0x1c(%eax),%eax
80104c51:	8b 40 0c             	mov    0xc(%eax),%eax
80104c54:	83 c0 08             	add    $0x8,%eax
80104c57:	8d 55 c4             	lea    -0x3c(%ebp),%edx
80104c5a:	89 54 24 04          	mov    %edx,0x4(%esp)
80104c5e:	89 04 24             	mov    %eax,(%esp)
80104c61:	e8 62 04 00 00       	call   801050c8 <getcallerpcs>
      for(i=0; i<10 && pc[i] != 0; i++)
80104c66:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
80104c6d:	eb 1b                	jmp    80104c8a <procdump+0xc6>
        cprintf(" %p", pc[i]);
80104c6f:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104c72:	8b 44 85 c4          	mov    -0x3c(%ebp,%eax,4),%eax
80104c76:	89 44 24 04          	mov    %eax,0x4(%esp)
80104c7a:	c7 04 24 80 8a 10 80 	movl   $0x80108a80,(%esp)
80104c81:	e8 24 b7 ff ff       	call   801003aa <cprintf>
    else
      state = "???";
    cprintf("%d %s %s", p->pid, state, p->name);
    if(p->state == SLEEPING){
      getcallerpcs((uint*)p->context->ebp+2, pc);
      for(i=0; i<10 && pc[i] != 0; i++)
80104c86:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
80104c8a:	83 7d f4 09          	cmpl   $0x9,-0xc(%ebp)
80104c8e:	7f 0b                	jg     80104c9b <procdump+0xd7>
80104c90:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104c93:	8b 44 85 c4          	mov    -0x3c(%ebp,%eax,4),%eax
80104c97:	85 c0                	test   %eax,%eax
80104c99:	75 d4                	jne    80104c6f <procdump+0xab>
        cprintf(" %p", pc[i]);
    }
    cprintf("\n");
80104c9b:	c7 04 24 84 8a 10 80 	movl   $0x80108a84,(%esp)
80104ca2:	e8 03 b7 ff ff       	call   801003aa <cprintf>
80104ca7:	eb 01                	jmp    80104caa <procdump+0xe6>
  char *state;
  uint pc[10];
  
  for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
    if(p->state == UNUSED)
      continue;
80104ca9:	90                   	nop
  int i;
  struct proc *p;
  char *state;
  uint pc[10];
  
  for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80104caa:	81 45 f0 04 01 00 00 	addl   $0x104,-0x10(%ebp)
80104cb1:	81 7d f0 94 40 11 80 	cmpl   $0x80114094,-0x10(%ebp)
80104cb8:	0f 82 18 ff ff ff    	jb     80104bd6 <procdump+0x12>
      for(i=0; i<10 && pc[i] != 0; i++)
        cprintf(" %p", pc[i]);
    }
    cprintf("\n");
  }
}
80104cbe:	c9                   	leave  
80104cbf:	c3                   	ret    

80104cc0 <defaultHandler>:


  /** OUR ADDITION - 1.	1 **/
  void defaultHandler() {
80104cc0:	55                   	push   %ebp
80104cc1:	89 e5                	mov    %esp,%ebp
80104cc3:	83 ec 18             	sub    $0x18,%esp
	  cprintf("A signal was accepted by process %d\n", proc->pid);
80104cc6:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80104ccc:	8b 40 10             	mov    0x10(%eax),%eax
80104ccf:	89 44 24 04          	mov    %eax,0x4(%esp)
80104cd3:	c7 04 24 88 8a 10 80 	movl   $0x80108a88,(%esp)
80104cda:	e8 cb b6 ff ff       	call   801003aa <cprintf>

  }
80104cdf:	c9                   	leave  
80104ce0:	c3                   	ret    

80104ce1 <signal>:

  /** OUR ADDITION - 1.	2 **/
  int signal(int signum, sighandler_t handler)
  {
80104ce1:	55                   	push   %ebp
80104ce2:	89 e5                	mov    %esp,%ebp
80104ce4:	83 ec 20             	sub    $0x20,%esp
	  //input check
	  if(signum < 1 || signum > NUMSIG-1)
80104ce7:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
80104ceb:	7e 06                	jle    80104cf3 <signal+0x12>
80104ced:	83 7d 08 1f          	cmpl   $0x1f,0x8(%ebp)
80104cf1:	7e 07                	jle    80104cfa <signal+0x19>
	  	   return -1;
80104cf3:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80104cf8:	eb 67                	jmp    80104d61 <signal+0x80>
	  int temp[6]={7,19,20,21,22,24}; //not defined as signal numbers in signal.h
80104cfa:	c7 45 e4 07 00 00 00 	movl   $0x7,-0x1c(%ebp)
80104d01:	c7 45 e8 13 00 00 00 	movl   $0x13,-0x18(%ebp)
80104d08:	c7 45 ec 14 00 00 00 	movl   $0x14,-0x14(%ebp)
80104d0f:	c7 45 f0 15 00 00 00 	movl   $0x15,-0x10(%ebp)
80104d16:	c7 45 f4 16 00 00 00 	movl   $0x16,-0xc(%ebp)
80104d1d:	c7 45 f8 18 00 00 00 	movl   $0x18,-0x8(%ebp)
	  	int i;
	  	for (i=0; i<6; i++)
80104d24:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
80104d2b:	eb 17                	jmp    80104d44 <signal+0x63>
	  		if(signum==temp[i])
80104d2d:	8b 45 fc             	mov    -0x4(%ebp),%eax
80104d30:	8b 44 85 e4          	mov    -0x1c(%ebp,%eax,4),%eax
80104d34:	3b 45 08             	cmp    0x8(%ebp),%eax
80104d37:	75 07                	jne    80104d40 <signal+0x5f>
	  			return -1;
80104d39:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80104d3e:	eb 21                	jmp    80104d61 <signal+0x80>
	  //input check
	  if(signum < 1 || signum > NUMSIG-1)
	  	   return -1;
	  int temp[6]={7,19,20,21,22,24}; //not defined as signal numbers in signal.h
	  	int i;
	  	for (i=0; i<6; i++)
80104d40:	83 45 fc 01          	addl   $0x1,-0x4(%ebp)
80104d44:	83 7d fc 05          	cmpl   $0x5,-0x4(%ebp)
80104d48:	7e e3                	jle    80104d2d <signal+0x4c>
	  		if(signum==temp[i])
	  			return -1;

	  proc->handlers[signum]=handler;
80104d4a:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80104d50:	8b 55 08             	mov    0x8(%ebp),%edx
80104d53:	8d 4a 20             	lea    0x20(%edx),%ecx
80104d56:	8b 55 0c             	mov    0xc(%ebp),%edx
80104d59:	89 14 88             	mov    %edx,(%eax,%ecx,4)
	  return 0;
80104d5c:	b8 00 00 00 00       	mov    $0x0,%eax
  }
80104d61:	c9                   	leave  
80104d62:	c3                   	ret    

80104d63 <sigsend>:
  /** OUR ADDITION - 1.	3 **/
  int sigsend(int pid, int signum){
80104d63:	55                   	push   %ebp
80104d64:	89 e5                	mov    %esp,%ebp
80104d66:	56                   	push   %esi
80104d67:	53                   	push   %ebx
80104d68:	83 ec 30             	sub    $0x30,%esp

	//input check
	if(pid < 1 )
80104d6b:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
80104d6f:	7f 0a                	jg     80104d7b <sigsend+0x18>
		    return -1;
80104d71:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80104d76:	e9 01 01 00 00       	jmp    80104e7c <sigsend+0x119>
	if(signum < 1 || signum > NUMSIG-1)
80104d7b:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
80104d7f:	7e 06                	jle    80104d87 <sigsend+0x24>
80104d81:	83 7d 0c 1f          	cmpl   $0x1f,0xc(%ebp)
80104d85:	7e 0a                	jle    80104d91 <sigsend+0x2e>
		    return -1;
80104d87:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80104d8c:	e9 eb 00 00 00       	jmp    80104e7c <sigsend+0x119>
	int temp[6]={7,19,20,21,22,24}; //not defined as signal numbers in signal.h
80104d91:	c7 45 d8 07 00 00 00 	movl   $0x7,-0x28(%ebp)
80104d98:	c7 45 dc 13 00 00 00 	movl   $0x13,-0x24(%ebp)
80104d9f:	c7 45 e0 14 00 00 00 	movl   $0x14,-0x20(%ebp)
80104da6:	c7 45 e4 15 00 00 00 	movl   $0x15,-0x1c(%ebp)
80104dad:	c7 45 e8 16 00 00 00 	movl   $0x16,-0x18(%ebp)
80104db4:	c7 45 ec 18 00 00 00 	movl   $0x18,-0x14(%ebp)
	int i;
	for (i=0; i<6; i++)
80104dbb:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
80104dc2:	eb 1a                	jmp    80104dde <sigsend+0x7b>
		if(signum==temp[i])
80104dc4:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104dc7:	8b 44 85 d8          	mov    -0x28(%ebp,%eax,4),%eax
80104dcb:	3b 45 0c             	cmp    0xc(%ebp),%eax
80104dce:	75 0a                	jne    80104dda <sigsend+0x77>
			return -1;
80104dd0:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80104dd5:	e9 a2 00 00 00       	jmp    80104e7c <sigsend+0x119>
		    return -1;
	if(signum < 1 || signum > NUMSIG-1)
		    return -1;
	int temp[6]={7,19,20,21,22,24}; //not defined as signal numbers in signal.h
	int i;
	for (i=0; i<6; i++)
80104dda:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
80104dde:	83 7d f4 05          	cmpl   $0x5,-0xc(%ebp)
80104de2:	7e e0                	jle    80104dc4 <sigsend+0x61>
		if(signum==temp[i])
			return -1;

	struct proc *p;

	acquire(&ptable.lock);
80104de4:	c7 04 24 60 ff 10 80 	movl   $0x8010ff60,(%esp)
80104deb:	e8 27 02 00 00       	call   80105017 <acquire>
	for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80104df0:	c7 45 f0 94 ff 10 80 	movl   $0x8010ff94,-0x10(%ebp)
80104df7:	eb 69                	jmp    80104e62 <sigsend+0xff>
		if(p->pid == pid){
80104df9:	8b 45 f0             	mov    -0x10(%ebp),%eax
80104dfc:	8b 40 10             	mov    0x10(%eax),%eax
80104dff:	3b 45 08             	cmp    0x8(%ebp),%eax
80104e02:	75 57                	jne    80104e5b <sigsend+0xf8>
  	      if ( (1<<(signum-1)) & (p->pending == 0) ) //if bit not set to 1 already
80104e04:	8b 45 f0             	mov    -0x10(%ebp),%eax
80104e07:	8b 40 7c             	mov    0x7c(%eax),%eax
80104e0a:	85 c0                	test   %eax,%eax
80104e0c:	0f 94 c0             	sete   %al
80104e0f:	0f b6 d0             	movzbl %al,%edx
80104e12:	8b 45 0c             	mov    0xc(%ebp),%eax
80104e15:	83 e8 01             	sub    $0x1,%eax
80104e18:	89 d3                	mov    %edx,%ebx
80104e1a:	89 c1                	mov    %eax,%ecx
80104e1c:	d3 fb                	sar    %cl,%ebx
80104e1e:	89 d8                	mov    %ebx,%eax
80104e20:	83 e0 01             	and    $0x1,%eax
80104e23:	85 c0                	test   %eax,%eax
80104e25:	74 21                	je     80104e48 <sigsend+0xe5>
  	    	  p->pending+=1<<(signum-1);
80104e27:	8b 45 f0             	mov    -0x10(%ebp),%eax
80104e2a:	8b 50 7c             	mov    0x7c(%eax),%edx
80104e2d:	8b 45 0c             	mov    0xc(%ebp),%eax
80104e30:	83 e8 01             	sub    $0x1,%eax
80104e33:	bb 01 00 00 00       	mov    $0x1,%ebx
80104e38:	89 de                	mov    %ebx,%esi
80104e3a:	89 c1                	mov    %eax,%ecx
80104e3c:	d3 e6                	shl    %cl,%esi
80104e3e:	89 f0                	mov    %esi,%eax
80104e40:	01 c2                	add    %eax,%edx
80104e42:	8b 45 f0             	mov    -0x10(%ebp),%eax
80104e45:	89 50 7c             	mov    %edx,0x7c(%eax)
  	      release(&ptable.lock);
80104e48:	c7 04 24 60 ff 10 80 	movl   $0x8010ff60,(%esp)
80104e4f:	e8 25 02 00 00       	call   80105079 <release>
  	      return 0;
80104e54:	b8 00 00 00 00       	mov    $0x0,%eax
80104e59:	eb 21                	jmp    80104e7c <sigsend+0x119>
			return -1;

	struct proc *p;

	acquire(&ptable.lock);
	for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80104e5b:	81 45 f0 04 01 00 00 	addl   $0x104,-0x10(%ebp)
80104e62:	81 7d f0 94 40 11 80 	cmpl   $0x80114094,-0x10(%ebp)
80104e69:	72 8e                	jb     80104df9 <sigsend+0x96>
  	    	  p->pending+=1<<(signum-1);
  	      release(&ptable.lock);
  	      return 0;
  	    }
	}
	release(&ptable.lock);
80104e6b:	c7 04 24 60 ff 10 80 	movl   $0x8010ff60,(%esp)
80104e72:	e8 02 02 00 00       	call   80105079 <release>
	return -1;
80104e77:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
  }
80104e7c:	83 c4 30             	add    $0x30,%esp
80104e7f:	5b                   	pop    %ebx
80104e80:	5e                   	pop    %esi
80104e81:	5d                   	pop    %ebp
80104e82:	c3                   	ret    

80104e83 <alarm>:


/** OUR ADDITION - 1.6 **/
void alarm(int ticks){
80104e83:	55                   	push   %ebp
80104e84:	89 e5                	mov    %esp,%ebp
80104e86:	83 ec 10             	sub    $0x10,%esp
     if(ticks==0)            // if 0, cancel pending alarm request if exists
80104e89:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
80104e8d:	75 3f                	jne    80104ece <alarm+0x4b>
     {
         uint alarm_bit = 1 << (SIGALRM-1);
80104e8f:	c7 45 fc 00 20 00 00 	movl   $0x2000,-0x4(%ebp)
         if( (alarm_bit) & (proc->pending))           // if signal is on
80104e96:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80104e9c:	8b 40 7c             	mov    0x7c(%eax),%eax
80104e9f:	23 45 fc             	and    -0x4(%ebp),%eax
80104ea2:	85 c0                	test   %eax,%eax
80104ea4:	74 16                	je     80104ebc <alarm+0x39>
             proc->pending = proc->pending - alarm_bit; // switch bit back to 0
80104ea6:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80104eac:	65 8b 15 04 00 00 00 	mov    %gs:0x4,%edx
80104eb3:	8b 52 7c             	mov    0x7c(%edx),%edx
80104eb6:	2b 55 fc             	sub    -0x4(%ebp),%edx
80104eb9:	89 50 7c             	mov    %edx,0x7c(%eax)
         	 proc->num_ticks = -1;						//restore to initial value
80104ebc:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80104ec2:	c7 80 00 01 00 00 ff 	movl   $0xffffffff,0x100(%eax)
80104ec9:	ff ff ff 
80104ecc:	eb 0f                	jmp    80104edd <alarm+0x5a>
     }
     else
    	 proc->num_ticks = ticks;
80104ece:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80104ed4:	8b 55 08             	mov    0x8(%ebp),%edx
80104ed7:	89 90 00 01 00 00    	mov    %edx,0x100(%eax)
}
80104edd:	c9                   	leave  
80104ede:	c3                   	ret    

80104edf <updateTicks>:

/** OUR ADDITION - 1.6
    A function that decreases by 1 the number of ticks, for all processes
    that requested an alarm **/

void updateTicks(){
80104edf:	55                   	push   %ebp
80104ee0:	89 e5                	mov    %esp,%ebp
80104ee2:	83 ec 28             	sub    $0x28,%esp
	struct proc *p;
	acquire(&ptable.lock);
80104ee5:	c7 04 24 60 ff 10 80 	movl   $0x8010ff60,(%esp)
80104eec:	e8 26 01 00 00       	call   80105017 <acquire>
	for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
80104ef1:	c7 45 f4 94 ff 10 80 	movl   $0x8010ff94,-0xc(%ebp)
80104ef8:	eb 29                	jmp    80104f23 <updateTicks+0x44>
  	      if ( p->num_ticks>0 )
80104efa:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104efd:	8b 80 00 01 00 00    	mov    0x100(%eax),%eax
80104f03:	85 c0                	test   %eax,%eax
80104f05:	7e 15                	jle    80104f1c <updateTicks+0x3d>
  	    	  p->num_ticks--;
80104f07:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104f0a:	8b 80 00 01 00 00    	mov    0x100(%eax),%eax
80104f10:	8d 50 ff             	lea    -0x1(%eax),%edx
80104f13:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104f16:	89 90 00 01 00 00    	mov    %edx,0x100(%eax)
    that requested an alarm **/

void updateTicks(){
	struct proc *p;
	acquire(&ptable.lock);
	for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
80104f1c:	81 45 f4 04 01 00 00 	addl   $0x104,-0xc(%ebp)
80104f23:	81 7d f4 94 40 11 80 	cmpl   $0x80114094,-0xc(%ebp)
80104f2a:	72 ce                	jb     80104efa <updateTicks+0x1b>
  	      if ( p->num_ticks>0 )
  	    	  p->num_ticks--;
  	release(&ptable.lock);
80104f2c:	c7 04 24 60 ff 10 80 	movl   $0x8010ff60,(%esp)
80104f33:	e8 41 01 00 00       	call   80105079 <release>
}
80104f38:	c9                   	leave  
80104f39:	c3                   	ret    

80104f3a <raiseAlarm>:

/** OUR ADDITION - 1.6
    A function that changes the SIGALARM bit to 1, for all processes
    with 0 num_ticks left **/

void raiseAlarm(){
80104f3a:	55                   	push   %ebp
80104f3b:	89 e5                	mov    %esp,%ebp
80104f3d:	83 ec 28             	sub    $0x28,%esp
  struct proc *p;
  acquire(&ptable.lock);
80104f40:	c7 04 24 60 ff 10 80 	movl   $0x8010ff60,(%esp)
80104f47:	e8 cb 00 00 00       	call   80105017 <acquire>

  // look for processes who asked for an alarm and their time is up
  for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
80104f4c:	c7 45 f4 94 ff 10 80 	movl   $0x8010ff94,-0xc(%ebp)
80104f53:	eb 32                	jmp    80104f87 <raiseAlarm+0x4d>
	  if ( p->num_ticks==0 ){
80104f55:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104f58:	8b 80 00 01 00 00    	mov    0x100(%eax),%eax
80104f5e:	85 c0                	test   %eax,%eax
80104f60:	75 1e                	jne    80104f80 <raiseAlarm+0x46>
		  p->pending= p->pending | 0x2000; //change the SIGALRM bit to 1
80104f62:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104f65:	8b 40 7c             	mov    0x7c(%eax),%eax
80104f68:	89 c2                	mov    %eax,%edx
80104f6a:	80 ce 20             	or     $0x20,%dh
80104f6d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104f70:	89 50 7c             	mov    %edx,0x7c(%eax)
		  p->num_ticks=-1;
80104f73:	8b 45 f4             	mov    -0xc(%ebp),%eax
80104f76:	c7 80 00 01 00 00 ff 	movl   $0xffffffff,0x100(%eax)
80104f7d:	ff ff ff 
void raiseAlarm(){
  struct proc *p;
  acquire(&ptable.lock);

  // look for processes who asked for an alarm and their time is up
  for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
80104f80:	81 45 f4 04 01 00 00 	addl   $0x104,-0xc(%ebp)
80104f87:	81 7d f4 94 40 11 80 	cmpl   $0x80114094,-0xc(%ebp)
80104f8e:	72 c5                	jb     80104f55 <raiseAlarm+0x1b>
	  if ( p->num_ticks==0 ){
		  p->pending= p->pending | 0x2000; //change the SIGALRM bit to 1
		  p->num_ticks=-1;
	  }

  release(&ptable.lock);
80104f90:	c7 04 24 60 ff 10 80 	movl   $0x8010ff60,(%esp)
80104f97:	e8 dd 00 00 00       	call   80105079 <release>
}
80104f9c:	c9                   	leave  
80104f9d:	c3                   	ret    

80104f9e <getTicks>:

int getTicks()
{
80104f9e:	55                   	push   %ebp
80104f9f:	89 e5                	mov    %esp,%ebp
	return proc->num_ticks;
80104fa1:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80104fa7:	8b 80 00 01 00 00    	mov    0x100(%eax),%eax
}
80104fad:	5d                   	pop    %ebp
80104fae:	c3                   	ret    
80104faf:	90                   	nop

80104fb0 <readeflags>:
  asm volatile("ltr %0" : : "r" (sel));
}

static inline uint
readeflags(void)
{
80104fb0:	55                   	push   %ebp
80104fb1:	89 e5                	mov    %esp,%ebp
80104fb3:	53                   	push   %ebx
80104fb4:	83 ec 10             	sub    $0x10,%esp
  uint eflags;
  asm volatile("pushfl; popl %0" : "=r" (eflags));
80104fb7:	9c                   	pushf  
80104fb8:	5b                   	pop    %ebx
80104fb9:	89 5d f8             	mov    %ebx,-0x8(%ebp)
  return eflags;
80104fbc:	8b 45 f8             	mov    -0x8(%ebp),%eax
}
80104fbf:	83 c4 10             	add    $0x10,%esp
80104fc2:	5b                   	pop    %ebx
80104fc3:	5d                   	pop    %ebp
80104fc4:	c3                   	ret    

80104fc5 <cli>:
  asm volatile("movw %0, %%gs" : : "r" (v));
}

static inline void
cli(void)
{
80104fc5:	55                   	push   %ebp
80104fc6:	89 e5                	mov    %esp,%ebp
  asm volatile("cli");
80104fc8:	fa                   	cli    
}
80104fc9:	5d                   	pop    %ebp
80104fca:	c3                   	ret    

80104fcb <sti>:

static inline void
sti(void)
{
80104fcb:	55                   	push   %ebp
80104fcc:	89 e5                	mov    %esp,%ebp
  asm volatile("sti");
80104fce:	fb                   	sti    
}
80104fcf:	5d                   	pop    %ebp
80104fd0:	c3                   	ret    

80104fd1 <xchg>:

static inline uint
xchg(volatile uint *addr, uint newval)
{
80104fd1:	55                   	push   %ebp
80104fd2:	89 e5                	mov    %esp,%ebp
80104fd4:	53                   	push   %ebx
80104fd5:	83 ec 10             	sub    $0x10,%esp
  uint result;
  
  // The + in "+m" denotes a read-modify-write operand.
  asm volatile("lock; xchgl %0, %1" :
               "+m" (*addr), "=a" (result) :
80104fd8:	8b 55 08             	mov    0x8(%ebp),%edx
xchg(volatile uint *addr, uint newval)
{
  uint result;
  
  // The + in "+m" denotes a read-modify-write operand.
  asm volatile("lock; xchgl %0, %1" :
80104fdb:	8b 45 0c             	mov    0xc(%ebp),%eax
               "+m" (*addr), "=a" (result) :
80104fde:	8b 4d 08             	mov    0x8(%ebp),%ecx
xchg(volatile uint *addr, uint newval)
{
  uint result;
  
  // The + in "+m" denotes a read-modify-write operand.
  asm volatile("lock; xchgl %0, %1" :
80104fe1:	89 c3                	mov    %eax,%ebx
80104fe3:	89 d8                	mov    %ebx,%eax
80104fe5:	f0 87 02             	lock xchg %eax,(%edx)
80104fe8:	89 c3                	mov    %eax,%ebx
80104fea:	89 5d f8             	mov    %ebx,-0x8(%ebp)
               "+m" (*addr), "=a" (result) :
               "1" (newval) :
               "cc");
  return result;
80104fed:	8b 45 f8             	mov    -0x8(%ebp),%eax
}
80104ff0:	83 c4 10             	add    $0x10,%esp
80104ff3:	5b                   	pop    %ebx
80104ff4:	5d                   	pop    %ebp
80104ff5:	c3                   	ret    

80104ff6 <initlock>:
#include "proc.h"
#include "spinlock.h"

void
initlock(struct spinlock *lk, char *name)
{
80104ff6:	55                   	push   %ebp
80104ff7:	89 e5                	mov    %esp,%ebp
  lk->name = name;
80104ff9:	8b 45 08             	mov    0x8(%ebp),%eax
80104ffc:	8b 55 0c             	mov    0xc(%ebp),%edx
80104fff:	89 50 04             	mov    %edx,0x4(%eax)
  lk->locked = 0;
80105002:	8b 45 08             	mov    0x8(%ebp),%eax
80105005:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
  lk->cpu = 0;
8010500b:	8b 45 08             	mov    0x8(%ebp),%eax
8010500e:	c7 40 08 00 00 00 00 	movl   $0x0,0x8(%eax)
}
80105015:	5d                   	pop    %ebp
80105016:	c3                   	ret    

80105017 <acquire>:
// Loops (spins) until the lock is acquired.
// Holding a lock for a long time may cause
// other CPUs to waste time spinning to acquire it.
void
acquire(struct spinlock *lk)
{
80105017:	55                   	push   %ebp
80105018:	89 e5                	mov    %esp,%ebp
8010501a:	83 ec 18             	sub    $0x18,%esp
  pushcli(); // disable interrupts to avoid deadlock.
8010501d:	e8 49 01 00 00       	call   8010516b <pushcli>
  if(holding(lk))
80105022:	8b 45 08             	mov    0x8(%ebp),%eax
80105025:	89 04 24             	mov    %eax,(%esp)
80105028:	e8 14 01 00 00       	call   80105141 <holding>
8010502d:	85 c0                	test   %eax,%eax
8010502f:	74 0c                	je     8010503d <acquire+0x26>
    panic("acquire");
80105031:	c7 04 24 d7 8a 10 80 	movl   $0x80108ad7,(%esp)
80105038:	e8 09 b5 ff ff       	call   80100546 <panic>

  // The xchg is atomic.
  // It also serializes, so that reads after acquire are not
  // reordered before it. 
  while(xchg(&lk->locked, 1) != 0)
8010503d:	90                   	nop
8010503e:	8b 45 08             	mov    0x8(%ebp),%eax
80105041:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
80105048:	00 
80105049:	89 04 24             	mov    %eax,(%esp)
8010504c:	e8 80 ff ff ff       	call   80104fd1 <xchg>
80105051:	85 c0                	test   %eax,%eax
80105053:	75 e9                	jne    8010503e <acquire+0x27>
    ;

  // Record info about lock acquisition for debugging.
  lk->cpu = cpu;
80105055:	8b 45 08             	mov    0x8(%ebp),%eax
80105058:	65 8b 15 00 00 00 00 	mov    %gs:0x0,%edx
8010505f:	89 50 08             	mov    %edx,0x8(%eax)
  getcallerpcs(&lk, lk->pcs);
80105062:	8b 45 08             	mov    0x8(%ebp),%eax
80105065:	83 c0 0c             	add    $0xc,%eax
80105068:	89 44 24 04          	mov    %eax,0x4(%esp)
8010506c:	8d 45 08             	lea    0x8(%ebp),%eax
8010506f:	89 04 24             	mov    %eax,(%esp)
80105072:	e8 51 00 00 00       	call   801050c8 <getcallerpcs>
}
80105077:	c9                   	leave  
80105078:	c3                   	ret    

80105079 <release>:

// Release the lock.
void
release(struct spinlock *lk)
{
80105079:	55                   	push   %ebp
8010507a:	89 e5                	mov    %esp,%ebp
8010507c:	83 ec 18             	sub    $0x18,%esp
  if(!holding(lk))
8010507f:	8b 45 08             	mov    0x8(%ebp),%eax
80105082:	89 04 24             	mov    %eax,(%esp)
80105085:	e8 b7 00 00 00       	call   80105141 <holding>
8010508a:	85 c0                	test   %eax,%eax
8010508c:	75 0c                	jne    8010509a <release+0x21>
    panic("release");
8010508e:	c7 04 24 df 8a 10 80 	movl   $0x80108adf,(%esp)
80105095:	e8 ac b4 ff ff       	call   80100546 <panic>

  lk->pcs[0] = 0;
8010509a:	8b 45 08             	mov    0x8(%ebp),%eax
8010509d:	c7 40 0c 00 00 00 00 	movl   $0x0,0xc(%eax)
  lk->cpu = 0;
801050a4:	8b 45 08             	mov    0x8(%ebp),%eax
801050a7:	c7 40 08 00 00 00 00 	movl   $0x0,0x8(%eax)
  // But the 2007 Intel 64 Architecture Memory Ordering White
  // Paper says that Intel 64 and IA-32 will not move a load
  // after a store. So lock->locked = 0 would work here.
  // The xchg being asm volatile ensures gcc emits it after
  // the above assignments (and after the critical section).
  xchg(&lk->locked, 0);
801050ae:	8b 45 08             	mov    0x8(%ebp),%eax
801050b1:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
801050b8:	00 
801050b9:	89 04 24             	mov    %eax,(%esp)
801050bc:	e8 10 ff ff ff       	call   80104fd1 <xchg>

  popcli();
801050c1:	e8 ed 00 00 00       	call   801051b3 <popcli>
}
801050c6:	c9                   	leave  
801050c7:	c3                   	ret    

801050c8 <getcallerpcs>:

// Record the current call stack in pcs[] by following the %ebp chain.
void
getcallerpcs(void *v, uint pcs[])
{
801050c8:	55                   	push   %ebp
801050c9:	89 e5                	mov    %esp,%ebp
801050cb:	83 ec 10             	sub    $0x10,%esp
  uint *ebp;
  int i;
  
  ebp = (uint*)v - 2;
801050ce:	8b 45 08             	mov    0x8(%ebp),%eax
801050d1:	83 e8 08             	sub    $0x8,%eax
801050d4:	89 45 fc             	mov    %eax,-0x4(%ebp)
  for(i = 0; i < 10; i++){
801050d7:	c7 45 f8 00 00 00 00 	movl   $0x0,-0x8(%ebp)
801050de:	eb 38                	jmp    80105118 <getcallerpcs+0x50>
    if(ebp == 0 || ebp < (uint*)KERNBASE || ebp == (uint*)0xffffffff)
801050e0:	83 7d fc 00          	cmpl   $0x0,-0x4(%ebp)
801050e4:	74 53                	je     80105139 <getcallerpcs+0x71>
801050e6:	81 7d fc ff ff ff 7f 	cmpl   $0x7fffffff,-0x4(%ebp)
801050ed:	76 4a                	jbe    80105139 <getcallerpcs+0x71>
801050ef:	83 7d fc ff          	cmpl   $0xffffffff,-0x4(%ebp)
801050f3:	74 44                	je     80105139 <getcallerpcs+0x71>
      break;
    pcs[i] = ebp[1];     // saved %eip
801050f5:	8b 45 f8             	mov    -0x8(%ebp),%eax
801050f8:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
801050ff:	8b 45 0c             	mov    0xc(%ebp),%eax
80105102:	01 c2                	add    %eax,%edx
80105104:	8b 45 fc             	mov    -0x4(%ebp),%eax
80105107:	8b 40 04             	mov    0x4(%eax),%eax
8010510a:	89 02                	mov    %eax,(%edx)
    ebp = (uint*)ebp[0]; // saved %ebp
8010510c:	8b 45 fc             	mov    -0x4(%ebp),%eax
8010510f:	8b 00                	mov    (%eax),%eax
80105111:	89 45 fc             	mov    %eax,-0x4(%ebp)
{
  uint *ebp;
  int i;
  
  ebp = (uint*)v - 2;
  for(i = 0; i < 10; i++){
80105114:	83 45 f8 01          	addl   $0x1,-0x8(%ebp)
80105118:	83 7d f8 09          	cmpl   $0x9,-0x8(%ebp)
8010511c:	7e c2                	jle    801050e0 <getcallerpcs+0x18>
    if(ebp == 0 || ebp < (uint*)KERNBASE || ebp == (uint*)0xffffffff)
      break;
    pcs[i] = ebp[1];     // saved %eip
    ebp = (uint*)ebp[0]; // saved %ebp
  }
  for(; i < 10; i++)
8010511e:	eb 19                	jmp    80105139 <getcallerpcs+0x71>
    pcs[i] = 0;
80105120:	8b 45 f8             	mov    -0x8(%ebp),%eax
80105123:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
8010512a:	8b 45 0c             	mov    0xc(%ebp),%eax
8010512d:	01 d0                	add    %edx,%eax
8010512f:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
    if(ebp == 0 || ebp < (uint*)KERNBASE || ebp == (uint*)0xffffffff)
      break;
    pcs[i] = ebp[1];     // saved %eip
    ebp = (uint*)ebp[0]; // saved %ebp
  }
  for(; i < 10; i++)
80105135:	83 45 f8 01          	addl   $0x1,-0x8(%ebp)
80105139:	83 7d f8 09          	cmpl   $0x9,-0x8(%ebp)
8010513d:	7e e1                	jle    80105120 <getcallerpcs+0x58>
    pcs[i] = 0;
}
8010513f:	c9                   	leave  
80105140:	c3                   	ret    

80105141 <holding>:

// Check whether this cpu is holding the lock.
int
holding(struct spinlock *lock)
{
80105141:	55                   	push   %ebp
80105142:	89 e5                	mov    %esp,%ebp
  return lock->locked && lock->cpu == cpu;
80105144:	8b 45 08             	mov    0x8(%ebp),%eax
80105147:	8b 00                	mov    (%eax),%eax
80105149:	85 c0                	test   %eax,%eax
8010514b:	74 17                	je     80105164 <holding+0x23>
8010514d:	8b 45 08             	mov    0x8(%ebp),%eax
80105150:	8b 50 08             	mov    0x8(%eax),%edx
80105153:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
80105159:	39 c2                	cmp    %eax,%edx
8010515b:	75 07                	jne    80105164 <holding+0x23>
8010515d:	b8 01 00 00 00       	mov    $0x1,%eax
80105162:	eb 05                	jmp    80105169 <holding+0x28>
80105164:	b8 00 00 00 00       	mov    $0x0,%eax
}
80105169:	5d                   	pop    %ebp
8010516a:	c3                   	ret    

8010516b <pushcli>:
// it takes two popcli to undo two pushcli.  Also, if interrupts
// are off, then pushcli, popcli leaves them off.

void
pushcli(void)
{
8010516b:	55                   	push   %ebp
8010516c:	89 e5                	mov    %esp,%ebp
8010516e:	83 ec 10             	sub    $0x10,%esp
  int eflags;
  
  eflags = readeflags();
80105171:	e8 3a fe ff ff       	call   80104fb0 <readeflags>
80105176:	89 45 fc             	mov    %eax,-0x4(%ebp)
  cli();
80105179:	e8 47 fe ff ff       	call   80104fc5 <cli>
  if(cpu->ncli++ == 0)
8010517e:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
80105184:	8b 90 ac 00 00 00    	mov    0xac(%eax),%edx
8010518a:	85 d2                	test   %edx,%edx
8010518c:	0f 94 c1             	sete   %cl
8010518f:	83 c2 01             	add    $0x1,%edx
80105192:	89 90 ac 00 00 00    	mov    %edx,0xac(%eax)
80105198:	84 c9                	test   %cl,%cl
8010519a:	74 15                	je     801051b1 <pushcli+0x46>
    cpu->intena = eflags & FL_IF;
8010519c:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
801051a2:	8b 55 fc             	mov    -0x4(%ebp),%edx
801051a5:	81 e2 00 02 00 00    	and    $0x200,%edx
801051ab:	89 90 b0 00 00 00    	mov    %edx,0xb0(%eax)
}
801051b1:	c9                   	leave  
801051b2:	c3                   	ret    

801051b3 <popcli>:

void
popcli(void)
{
801051b3:	55                   	push   %ebp
801051b4:	89 e5                	mov    %esp,%ebp
801051b6:	83 ec 18             	sub    $0x18,%esp
  if(readeflags()&FL_IF)
801051b9:	e8 f2 fd ff ff       	call   80104fb0 <readeflags>
801051be:	25 00 02 00 00       	and    $0x200,%eax
801051c3:	85 c0                	test   %eax,%eax
801051c5:	74 0c                	je     801051d3 <popcli+0x20>
    panic("popcli - interruptible");
801051c7:	c7 04 24 e7 8a 10 80 	movl   $0x80108ae7,(%esp)
801051ce:	e8 73 b3 ff ff       	call   80100546 <panic>
  if(--cpu->ncli < 0)
801051d3:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
801051d9:	8b 90 ac 00 00 00    	mov    0xac(%eax),%edx
801051df:	83 ea 01             	sub    $0x1,%edx
801051e2:	89 90 ac 00 00 00    	mov    %edx,0xac(%eax)
801051e8:	8b 80 ac 00 00 00    	mov    0xac(%eax),%eax
801051ee:	85 c0                	test   %eax,%eax
801051f0:	79 0c                	jns    801051fe <popcli+0x4b>
    panic("popcli");
801051f2:	c7 04 24 fe 8a 10 80 	movl   $0x80108afe,(%esp)
801051f9:	e8 48 b3 ff ff       	call   80100546 <panic>
  if(cpu->ncli == 0 && cpu->intena)
801051fe:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
80105204:	8b 80 ac 00 00 00    	mov    0xac(%eax),%eax
8010520a:	85 c0                	test   %eax,%eax
8010520c:	75 15                	jne    80105223 <popcli+0x70>
8010520e:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
80105214:	8b 80 b0 00 00 00    	mov    0xb0(%eax),%eax
8010521a:	85 c0                	test   %eax,%eax
8010521c:	74 05                	je     80105223 <popcli+0x70>
    sti();
8010521e:	e8 a8 fd ff ff       	call   80104fcb <sti>
}
80105223:	c9                   	leave  
80105224:	c3                   	ret    
80105225:	66 90                	xchg   %ax,%ax
80105227:	90                   	nop

80105228 <stosb>:
               "cc");
}

static inline void
stosb(void *addr, int data, int cnt)
{
80105228:	55                   	push   %ebp
80105229:	89 e5                	mov    %esp,%ebp
8010522b:	57                   	push   %edi
8010522c:	53                   	push   %ebx
  asm volatile("cld; rep stosb" :
8010522d:	8b 4d 08             	mov    0x8(%ebp),%ecx
80105230:	8b 55 10             	mov    0x10(%ebp),%edx
80105233:	8b 45 0c             	mov    0xc(%ebp),%eax
80105236:	89 cb                	mov    %ecx,%ebx
80105238:	89 df                	mov    %ebx,%edi
8010523a:	89 d1                	mov    %edx,%ecx
8010523c:	fc                   	cld    
8010523d:	f3 aa                	rep stos %al,%es:(%edi)
8010523f:	89 ca                	mov    %ecx,%edx
80105241:	89 fb                	mov    %edi,%ebx
80105243:	89 5d 08             	mov    %ebx,0x8(%ebp)
80105246:	89 55 10             	mov    %edx,0x10(%ebp)
               "=D" (addr), "=c" (cnt) :
               "0" (addr), "1" (cnt), "a" (data) :
               "memory", "cc");
}
80105249:	5b                   	pop    %ebx
8010524a:	5f                   	pop    %edi
8010524b:	5d                   	pop    %ebp
8010524c:	c3                   	ret    

8010524d <stosl>:

static inline void
stosl(void *addr, int data, int cnt)
{
8010524d:	55                   	push   %ebp
8010524e:	89 e5                	mov    %esp,%ebp
80105250:	57                   	push   %edi
80105251:	53                   	push   %ebx
  asm volatile("cld; rep stosl" :
80105252:	8b 4d 08             	mov    0x8(%ebp),%ecx
80105255:	8b 55 10             	mov    0x10(%ebp),%edx
80105258:	8b 45 0c             	mov    0xc(%ebp),%eax
8010525b:	89 cb                	mov    %ecx,%ebx
8010525d:	89 df                	mov    %ebx,%edi
8010525f:	89 d1                	mov    %edx,%ecx
80105261:	fc                   	cld    
80105262:	f3 ab                	rep stos %eax,%es:(%edi)
80105264:	89 ca                	mov    %ecx,%edx
80105266:	89 fb                	mov    %edi,%ebx
80105268:	89 5d 08             	mov    %ebx,0x8(%ebp)
8010526b:	89 55 10             	mov    %edx,0x10(%ebp)
               "=D" (addr), "=c" (cnt) :
               "0" (addr), "1" (cnt), "a" (data) :
               "memory", "cc");
}
8010526e:	5b                   	pop    %ebx
8010526f:	5f                   	pop    %edi
80105270:	5d                   	pop    %ebp
80105271:	c3                   	ret    

80105272 <memset>:
#include "types.h"
#include "x86.h"

void*
memset(void *dst, int c, uint n)
{
80105272:	55                   	push   %ebp
80105273:	89 e5                	mov    %esp,%ebp
80105275:	83 ec 0c             	sub    $0xc,%esp
  if ((int)dst%4 == 0 && n%4 == 0){
80105278:	8b 45 08             	mov    0x8(%ebp),%eax
8010527b:	83 e0 03             	and    $0x3,%eax
8010527e:	85 c0                	test   %eax,%eax
80105280:	75 49                	jne    801052cb <memset+0x59>
80105282:	8b 45 10             	mov    0x10(%ebp),%eax
80105285:	83 e0 03             	and    $0x3,%eax
80105288:	85 c0                	test   %eax,%eax
8010528a:	75 3f                	jne    801052cb <memset+0x59>
    c &= 0xFF;
8010528c:	81 65 0c ff 00 00 00 	andl   $0xff,0xc(%ebp)
    stosl(dst, (c<<24)|(c<<16)|(c<<8)|c, n/4);
80105293:	8b 45 10             	mov    0x10(%ebp),%eax
80105296:	c1 e8 02             	shr    $0x2,%eax
80105299:	89 c2                	mov    %eax,%edx
8010529b:	8b 45 0c             	mov    0xc(%ebp),%eax
8010529e:	89 c1                	mov    %eax,%ecx
801052a0:	c1 e1 18             	shl    $0x18,%ecx
801052a3:	8b 45 0c             	mov    0xc(%ebp),%eax
801052a6:	c1 e0 10             	shl    $0x10,%eax
801052a9:	09 c1                	or     %eax,%ecx
801052ab:	8b 45 0c             	mov    0xc(%ebp),%eax
801052ae:	c1 e0 08             	shl    $0x8,%eax
801052b1:	09 c8                	or     %ecx,%eax
801052b3:	0b 45 0c             	or     0xc(%ebp),%eax
801052b6:	89 54 24 08          	mov    %edx,0x8(%esp)
801052ba:	89 44 24 04          	mov    %eax,0x4(%esp)
801052be:	8b 45 08             	mov    0x8(%ebp),%eax
801052c1:	89 04 24             	mov    %eax,(%esp)
801052c4:	e8 84 ff ff ff       	call   8010524d <stosl>
801052c9:	eb 19                	jmp    801052e4 <memset+0x72>
  } else
    stosb(dst, c, n);
801052cb:	8b 45 10             	mov    0x10(%ebp),%eax
801052ce:	89 44 24 08          	mov    %eax,0x8(%esp)
801052d2:	8b 45 0c             	mov    0xc(%ebp),%eax
801052d5:	89 44 24 04          	mov    %eax,0x4(%esp)
801052d9:	8b 45 08             	mov    0x8(%ebp),%eax
801052dc:	89 04 24             	mov    %eax,(%esp)
801052df:	e8 44 ff ff ff       	call   80105228 <stosb>
  return dst;
801052e4:	8b 45 08             	mov    0x8(%ebp),%eax
}
801052e7:	c9                   	leave  
801052e8:	c3                   	ret    

801052e9 <memcmp>:

int
memcmp(const void *v1, const void *v2, uint n)
{
801052e9:	55                   	push   %ebp
801052ea:	89 e5                	mov    %esp,%ebp
801052ec:	83 ec 10             	sub    $0x10,%esp
  const uchar *s1, *s2;
  
  s1 = v1;
801052ef:	8b 45 08             	mov    0x8(%ebp),%eax
801052f2:	89 45 fc             	mov    %eax,-0x4(%ebp)
  s2 = v2;
801052f5:	8b 45 0c             	mov    0xc(%ebp),%eax
801052f8:	89 45 f8             	mov    %eax,-0x8(%ebp)
  while(n-- > 0){
801052fb:	eb 32                	jmp    8010532f <memcmp+0x46>
    if(*s1 != *s2)
801052fd:	8b 45 fc             	mov    -0x4(%ebp),%eax
80105300:	0f b6 10             	movzbl (%eax),%edx
80105303:	8b 45 f8             	mov    -0x8(%ebp),%eax
80105306:	0f b6 00             	movzbl (%eax),%eax
80105309:	38 c2                	cmp    %al,%dl
8010530b:	74 1a                	je     80105327 <memcmp+0x3e>
      return *s1 - *s2;
8010530d:	8b 45 fc             	mov    -0x4(%ebp),%eax
80105310:	0f b6 00             	movzbl (%eax),%eax
80105313:	0f b6 d0             	movzbl %al,%edx
80105316:	8b 45 f8             	mov    -0x8(%ebp),%eax
80105319:	0f b6 00             	movzbl (%eax),%eax
8010531c:	0f b6 c0             	movzbl %al,%eax
8010531f:	89 d1                	mov    %edx,%ecx
80105321:	29 c1                	sub    %eax,%ecx
80105323:	89 c8                	mov    %ecx,%eax
80105325:	eb 1c                	jmp    80105343 <memcmp+0x5a>
    s1++, s2++;
80105327:	83 45 fc 01          	addl   $0x1,-0x4(%ebp)
8010532b:	83 45 f8 01          	addl   $0x1,-0x8(%ebp)
{
  const uchar *s1, *s2;
  
  s1 = v1;
  s2 = v2;
  while(n-- > 0){
8010532f:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
80105333:	0f 95 c0             	setne  %al
80105336:	83 6d 10 01          	subl   $0x1,0x10(%ebp)
8010533a:	84 c0                	test   %al,%al
8010533c:	75 bf                	jne    801052fd <memcmp+0x14>
    if(*s1 != *s2)
      return *s1 - *s2;
    s1++, s2++;
  }

  return 0;
8010533e:	b8 00 00 00 00       	mov    $0x0,%eax
}
80105343:	c9                   	leave  
80105344:	c3                   	ret    

80105345 <memmove>:

void*
memmove(void *dst, const void *src, uint n)
{
80105345:	55                   	push   %ebp
80105346:	89 e5                	mov    %esp,%ebp
80105348:	83 ec 10             	sub    $0x10,%esp
  const char *s;
  char *d;

  s = src;
8010534b:	8b 45 0c             	mov    0xc(%ebp),%eax
8010534e:	89 45 fc             	mov    %eax,-0x4(%ebp)
  d = dst;
80105351:	8b 45 08             	mov    0x8(%ebp),%eax
80105354:	89 45 f8             	mov    %eax,-0x8(%ebp)
  if(s < d && s + n > d){
80105357:	8b 45 fc             	mov    -0x4(%ebp),%eax
8010535a:	3b 45 f8             	cmp    -0x8(%ebp),%eax
8010535d:	73 54                	jae    801053b3 <memmove+0x6e>
8010535f:	8b 45 10             	mov    0x10(%ebp),%eax
80105362:	8b 55 fc             	mov    -0x4(%ebp),%edx
80105365:	01 d0                	add    %edx,%eax
80105367:	3b 45 f8             	cmp    -0x8(%ebp),%eax
8010536a:	76 47                	jbe    801053b3 <memmove+0x6e>
    s += n;
8010536c:	8b 45 10             	mov    0x10(%ebp),%eax
8010536f:	01 45 fc             	add    %eax,-0x4(%ebp)
    d += n;
80105372:	8b 45 10             	mov    0x10(%ebp),%eax
80105375:	01 45 f8             	add    %eax,-0x8(%ebp)
    while(n-- > 0)
80105378:	eb 13                	jmp    8010538d <memmove+0x48>
      *--d = *--s;
8010537a:	83 6d f8 01          	subl   $0x1,-0x8(%ebp)
8010537e:	83 6d fc 01          	subl   $0x1,-0x4(%ebp)
80105382:	8b 45 fc             	mov    -0x4(%ebp),%eax
80105385:	0f b6 10             	movzbl (%eax),%edx
80105388:	8b 45 f8             	mov    -0x8(%ebp),%eax
8010538b:	88 10                	mov    %dl,(%eax)
  s = src;
  d = dst;
  if(s < d && s + n > d){
    s += n;
    d += n;
    while(n-- > 0)
8010538d:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
80105391:	0f 95 c0             	setne  %al
80105394:	83 6d 10 01          	subl   $0x1,0x10(%ebp)
80105398:	84 c0                	test   %al,%al
8010539a:	75 de                	jne    8010537a <memmove+0x35>
  const char *s;
  char *d;

  s = src;
  d = dst;
  if(s < d && s + n > d){
8010539c:	eb 25                	jmp    801053c3 <memmove+0x7e>
    d += n;
    while(n-- > 0)
      *--d = *--s;
  } else
    while(n-- > 0)
      *d++ = *s++;
8010539e:	8b 45 fc             	mov    -0x4(%ebp),%eax
801053a1:	0f b6 10             	movzbl (%eax),%edx
801053a4:	8b 45 f8             	mov    -0x8(%ebp),%eax
801053a7:	88 10                	mov    %dl,(%eax)
801053a9:	83 45 f8 01          	addl   $0x1,-0x8(%ebp)
801053ad:	83 45 fc 01          	addl   $0x1,-0x4(%ebp)
801053b1:	eb 01                	jmp    801053b4 <memmove+0x6f>
    s += n;
    d += n;
    while(n-- > 0)
      *--d = *--s;
  } else
    while(n-- > 0)
801053b3:	90                   	nop
801053b4:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
801053b8:	0f 95 c0             	setne  %al
801053bb:	83 6d 10 01          	subl   $0x1,0x10(%ebp)
801053bf:	84 c0                	test   %al,%al
801053c1:	75 db                	jne    8010539e <memmove+0x59>
      *d++ = *s++;

  return dst;
801053c3:	8b 45 08             	mov    0x8(%ebp),%eax
}
801053c6:	c9                   	leave  
801053c7:	c3                   	ret    

801053c8 <memcpy>:

// memcpy exists to placate GCC.  Use memmove.
void*
memcpy(void *dst, const void *src, uint n)
{
801053c8:	55                   	push   %ebp
801053c9:	89 e5                	mov    %esp,%ebp
801053cb:	83 ec 0c             	sub    $0xc,%esp
  return memmove(dst, src, n);
801053ce:	8b 45 10             	mov    0x10(%ebp),%eax
801053d1:	89 44 24 08          	mov    %eax,0x8(%esp)
801053d5:	8b 45 0c             	mov    0xc(%ebp),%eax
801053d8:	89 44 24 04          	mov    %eax,0x4(%esp)
801053dc:	8b 45 08             	mov    0x8(%ebp),%eax
801053df:	89 04 24             	mov    %eax,(%esp)
801053e2:	e8 5e ff ff ff       	call   80105345 <memmove>
}
801053e7:	c9                   	leave  
801053e8:	c3                   	ret    

801053e9 <strncmp>:

int
strncmp(const char *p, const char *q, uint n)
{
801053e9:	55                   	push   %ebp
801053ea:	89 e5                	mov    %esp,%ebp
  while(n > 0 && *p && *p == *q)
801053ec:	eb 0c                	jmp    801053fa <strncmp+0x11>
    n--, p++, q++;
801053ee:	83 6d 10 01          	subl   $0x1,0x10(%ebp)
801053f2:	83 45 08 01          	addl   $0x1,0x8(%ebp)
801053f6:	83 45 0c 01          	addl   $0x1,0xc(%ebp)
}

int
strncmp(const char *p, const char *q, uint n)
{
  while(n > 0 && *p && *p == *q)
801053fa:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
801053fe:	74 1a                	je     8010541a <strncmp+0x31>
80105400:	8b 45 08             	mov    0x8(%ebp),%eax
80105403:	0f b6 00             	movzbl (%eax),%eax
80105406:	84 c0                	test   %al,%al
80105408:	74 10                	je     8010541a <strncmp+0x31>
8010540a:	8b 45 08             	mov    0x8(%ebp),%eax
8010540d:	0f b6 10             	movzbl (%eax),%edx
80105410:	8b 45 0c             	mov    0xc(%ebp),%eax
80105413:	0f b6 00             	movzbl (%eax),%eax
80105416:	38 c2                	cmp    %al,%dl
80105418:	74 d4                	je     801053ee <strncmp+0x5>
    n--, p++, q++;
  if(n == 0)
8010541a:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
8010541e:	75 07                	jne    80105427 <strncmp+0x3e>
    return 0;
80105420:	b8 00 00 00 00       	mov    $0x0,%eax
80105425:	eb 18                	jmp    8010543f <strncmp+0x56>
  return (uchar)*p - (uchar)*q;
80105427:	8b 45 08             	mov    0x8(%ebp),%eax
8010542a:	0f b6 00             	movzbl (%eax),%eax
8010542d:	0f b6 d0             	movzbl %al,%edx
80105430:	8b 45 0c             	mov    0xc(%ebp),%eax
80105433:	0f b6 00             	movzbl (%eax),%eax
80105436:	0f b6 c0             	movzbl %al,%eax
80105439:	89 d1                	mov    %edx,%ecx
8010543b:	29 c1                	sub    %eax,%ecx
8010543d:	89 c8                	mov    %ecx,%eax
}
8010543f:	5d                   	pop    %ebp
80105440:	c3                   	ret    

80105441 <strncpy>:

char*
strncpy(char *s, const char *t, int n)
{
80105441:	55                   	push   %ebp
80105442:	89 e5                	mov    %esp,%ebp
80105444:	83 ec 10             	sub    $0x10,%esp
  char *os;
  
  os = s;
80105447:	8b 45 08             	mov    0x8(%ebp),%eax
8010544a:	89 45 fc             	mov    %eax,-0x4(%ebp)
  while(n-- > 0 && (*s++ = *t++) != 0)
8010544d:	90                   	nop
8010544e:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
80105452:	0f 9f c0             	setg   %al
80105455:	83 6d 10 01          	subl   $0x1,0x10(%ebp)
80105459:	84 c0                	test   %al,%al
8010545b:	74 30                	je     8010548d <strncpy+0x4c>
8010545d:	8b 45 0c             	mov    0xc(%ebp),%eax
80105460:	0f b6 10             	movzbl (%eax),%edx
80105463:	8b 45 08             	mov    0x8(%ebp),%eax
80105466:	88 10                	mov    %dl,(%eax)
80105468:	8b 45 08             	mov    0x8(%ebp),%eax
8010546b:	0f b6 00             	movzbl (%eax),%eax
8010546e:	84 c0                	test   %al,%al
80105470:	0f 95 c0             	setne  %al
80105473:	83 45 08 01          	addl   $0x1,0x8(%ebp)
80105477:	83 45 0c 01          	addl   $0x1,0xc(%ebp)
8010547b:	84 c0                	test   %al,%al
8010547d:	75 cf                	jne    8010544e <strncpy+0xd>
    ;
  while(n-- > 0)
8010547f:	eb 0c                	jmp    8010548d <strncpy+0x4c>
    *s++ = 0;
80105481:	8b 45 08             	mov    0x8(%ebp),%eax
80105484:	c6 00 00             	movb   $0x0,(%eax)
80105487:	83 45 08 01          	addl   $0x1,0x8(%ebp)
8010548b:	eb 01                	jmp    8010548e <strncpy+0x4d>
  char *os;
  
  os = s;
  while(n-- > 0 && (*s++ = *t++) != 0)
    ;
  while(n-- > 0)
8010548d:	90                   	nop
8010548e:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
80105492:	0f 9f c0             	setg   %al
80105495:	83 6d 10 01          	subl   $0x1,0x10(%ebp)
80105499:	84 c0                	test   %al,%al
8010549b:	75 e4                	jne    80105481 <strncpy+0x40>
    *s++ = 0;
  return os;
8010549d:	8b 45 fc             	mov    -0x4(%ebp),%eax
}
801054a0:	c9                   	leave  
801054a1:	c3                   	ret    

801054a2 <safestrcpy>:

// Like strncpy but guaranteed to NUL-terminate.
char*
safestrcpy(char *s, const char *t, int n)
{
801054a2:	55                   	push   %ebp
801054a3:	89 e5                	mov    %esp,%ebp
801054a5:	83 ec 10             	sub    $0x10,%esp
  char *os;
  
  os = s;
801054a8:	8b 45 08             	mov    0x8(%ebp),%eax
801054ab:	89 45 fc             	mov    %eax,-0x4(%ebp)
  if(n <= 0)
801054ae:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
801054b2:	7f 05                	jg     801054b9 <safestrcpy+0x17>
    return os;
801054b4:	8b 45 fc             	mov    -0x4(%ebp),%eax
801054b7:	eb 35                	jmp    801054ee <safestrcpy+0x4c>
  while(--n > 0 && (*s++ = *t++) != 0)
801054b9:	83 6d 10 01          	subl   $0x1,0x10(%ebp)
801054bd:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
801054c1:	7e 22                	jle    801054e5 <safestrcpy+0x43>
801054c3:	8b 45 0c             	mov    0xc(%ebp),%eax
801054c6:	0f b6 10             	movzbl (%eax),%edx
801054c9:	8b 45 08             	mov    0x8(%ebp),%eax
801054cc:	88 10                	mov    %dl,(%eax)
801054ce:	8b 45 08             	mov    0x8(%ebp),%eax
801054d1:	0f b6 00             	movzbl (%eax),%eax
801054d4:	84 c0                	test   %al,%al
801054d6:	0f 95 c0             	setne  %al
801054d9:	83 45 08 01          	addl   $0x1,0x8(%ebp)
801054dd:	83 45 0c 01          	addl   $0x1,0xc(%ebp)
801054e1:	84 c0                	test   %al,%al
801054e3:	75 d4                	jne    801054b9 <safestrcpy+0x17>
    ;
  *s = 0;
801054e5:	8b 45 08             	mov    0x8(%ebp),%eax
801054e8:	c6 00 00             	movb   $0x0,(%eax)
  return os;
801054eb:	8b 45 fc             	mov    -0x4(%ebp),%eax
}
801054ee:	c9                   	leave  
801054ef:	c3                   	ret    

801054f0 <strlen>:

int
strlen(const char *s)
{
801054f0:	55                   	push   %ebp
801054f1:	89 e5                	mov    %esp,%ebp
801054f3:	83 ec 10             	sub    $0x10,%esp
  int n;

  for(n = 0; s[n]; n++)
801054f6:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
801054fd:	eb 04                	jmp    80105503 <strlen+0x13>
801054ff:	83 45 fc 01          	addl   $0x1,-0x4(%ebp)
80105503:	8b 55 fc             	mov    -0x4(%ebp),%edx
80105506:	8b 45 08             	mov    0x8(%ebp),%eax
80105509:	01 d0                	add    %edx,%eax
8010550b:	0f b6 00             	movzbl (%eax),%eax
8010550e:	84 c0                	test   %al,%al
80105510:	75 ed                	jne    801054ff <strlen+0xf>
    ;
  return n;
80105512:	8b 45 fc             	mov    -0x4(%ebp),%eax
}
80105515:	c9                   	leave  
80105516:	c3                   	ret    
80105517:	90                   	nop

80105518 <swtch>:
# Save current register context in old
# and then load register context from new.

.globl swtch
swtch:
  movl 4(%esp), %eax
80105518:	8b 44 24 04          	mov    0x4(%esp),%eax
  movl 8(%esp), %edx
8010551c:	8b 54 24 08          	mov    0x8(%esp),%edx

  # Save old callee-save registers
  pushl %ebp
80105520:	55                   	push   %ebp
  pushl %ebx
80105521:	53                   	push   %ebx
  pushl %esi
80105522:	56                   	push   %esi
  pushl %edi
80105523:	57                   	push   %edi

  # Switch stacks
  movl %esp, (%eax)
80105524:	89 20                	mov    %esp,(%eax)
  movl %edx, %esp
80105526:	89 d4                	mov    %edx,%esp

  # Load new callee-save registers
  popl %edi
80105528:	5f                   	pop    %edi
  popl %esi
80105529:	5e                   	pop    %esi
  popl %ebx
8010552a:	5b                   	pop    %ebx
  popl %ebp
8010552b:	5d                   	pop    %ebp
  ret
8010552c:	c3                   	ret    
8010552d:	66 90                	xchg   %ax,%ax
8010552f:	90                   	nop

80105530 <fetchint>:
// to a saved program counter, and then the first argument.

// Fetch the int at addr from process p.
int
fetchint(struct proc *p, uint addr, int *ip)
{
80105530:	55                   	push   %ebp
80105531:	89 e5                	mov    %esp,%ebp
  if(addr >= p->sz || addr+4 > p->sz)
80105533:	8b 45 08             	mov    0x8(%ebp),%eax
80105536:	8b 00                	mov    (%eax),%eax
80105538:	3b 45 0c             	cmp    0xc(%ebp),%eax
8010553b:	76 0f                	jbe    8010554c <fetchint+0x1c>
8010553d:	8b 45 0c             	mov    0xc(%ebp),%eax
80105540:	8d 50 04             	lea    0x4(%eax),%edx
80105543:	8b 45 08             	mov    0x8(%ebp),%eax
80105546:	8b 00                	mov    (%eax),%eax
80105548:	39 c2                	cmp    %eax,%edx
8010554a:	76 07                	jbe    80105553 <fetchint+0x23>
    return -1;
8010554c:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80105551:	eb 0f                	jmp    80105562 <fetchint+0x32>
  *ip = *(int*)(addr);
80105553:	8b 45 0c             	mov    0xc(%ebp),%eax
80105556:	8b 10                	mov    (%eax),%edx
80105558:	8b 45 10             	mov    0x10(%ebp),%eax
8010555b:	89 10                	mov    %edx,(%eax)
  return 0;
8010555d:	b8 00 00 00 00       	mov    $0x0,%eax
}
80105562:	5d                   	pop    %ebp
80105563:	c3                   	ret    

80105564 <fetchstr>:
// Fetch the nul-terminated string at addr from process p.
// Doesn't actually copy the string - just sets *pp to point at it.
// Returns length of string, not including nul.
int
fetchstr(struct proc *p, uint addr, char **pp)
{
80105564:	55                   	push   %ebp
80105565:	89 e5                	mov    %esp,%ebp
80105567:	83 ec 10             	sub    $0x10,%esp
  char *s, *ep;

  if(addr >= p->sz)
8010556a:	8b 45 08             	mov    0x8(%ebp),%eax
8010556d:	8b 00                	mov    (%eax),%eax
8010556f:	3b 45 0c             	cmp    0xc(%ebp),%eax
80105572:	77 07                	ja     8010557b <fetchstr+0x17>
    return -1;
80105574:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80105579:	eb 45                	jmp    801055c0 <fetchstr+0x5c>
  *pp = (char*)addr;
8010557b:	8b 55 0c             	mov    0xc(%ebp),%edx
8010557e:	8b 45 10             	mov    0x10(%ebp),%eax
80105581:	89 10                	mov    %edx,(%eax)
  ep = (char*)p->sz;
80105583:	8b 45 08             	mov    0x8(%ebp),%eax
80105586:	8b 00                	mov    (%eax),%eax
80105588:	89 45 f8             	mov    %eax,-0x8(%ebp)
  for(s = *pp; s < ep; s++)
8010558b:	8b 45 10             	mov    0x10(%ebp),%eax
8010558e:	8b 00                	mov    (%eax),%eax
80105590:	89 45 fc             	mov    %eax,-0x4(%ebp)
80105593:	eb 1e                	jmp    801055b3 <fetchstr+0x4f>
    if(*s == 0)
80105595:	8b 45 fc             	mov    -0x4(%ebp),%eax
80105598:	0f b6 00             	movzbl (%eax),%eax
8010559b:	84 c0                	test   %al,%al
8010559d:	75 10                	jne    801055af <fetchstr+0x4b>
      return s - *pp;
8010559f:	8b 55 fc             	mov    -0x4(%ebp),%edx
801055a2:	8b 45 10             	mov    0x10(%ebp),%eax
801055a5:	8b 00                	mov    (%eax),%eax
801055a7:	89 d1                	mov    %edx,%ecx
801055a9:	29 c1                	sub    %eax,%ecx
801055ab:	89 c8                	mov    %ecx,%eax
801055ad:	eb 11                	jmp    801055c0 <fetchstr+0x5c>

  if(addr >= p->sz)
    return -1;
  *pp = (char*)addr;
  ep = (char*)p->sz;
  for(s = *pp; s < ep; s++)
801055af:	83 45 fc 01          	addl   $0x1,-0x4(%ebp)
801055b3:	8b 45 fc             	mov    -0x4(%ebp),%eax
801055b6:	3b 45 f8             	cmp    -0x8(%ebp),%eax
801055b9:	72 da                	jb     80105595 <fetchstr+0x31>
    if(*s == 0)
      return s - *pp;
  return -1;
801055bb:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
}
801055c0:	c9                   	leave  
801055c1:	c3                   	ret    

801055c2 <argint>:

// Fetch the nth 32-bit system call argument.
int
argint(int n, int *ip)
{
801055c2:	55                   	push   %ebp
801055c3:	89 e5                	mov    %esp,%ebp
801055c5:	83 ec 0c             	sub    $0xc,%esp
  return fetchint(proc, proc->tf->esp + 4 + 4*n, ip);
801055c8:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801055ce:	8b 40 18             	mov    0x18(%eax),%eax
801055d1:	8b 50 44             	mov    0x44(%eax),%edx
801055d4:	8b 45 08             	mov    0x8(%ebp),%eax
801055d7:	c1 e0 02             	shl    $0x2,%eax
801055da:	01 d0                	add    %edx,%eax
801055dc:	8d 48 04             	lea    0x4(%eax),%ecx
801055df:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801055e5:	8b 55 0c             	mov    0xc(%ebp),%edx
801055e8:	89 54 24 08          	mov    %edx,0x8(%esp)
801055ec:	89 4c 24 04          	mov    %ecx,0x4(%esp)
801055f0:	89 04 24             	mov    %eax,(%esp)
801055f3:	e8 38 ff ff ff       	call   80105530 <fetchint>
}
801055f8:	c9                   	leave  
801055f9:	c3                   	ret    

801055fa <argptr>:
// Fetch the nth word-sized system call argument as a pointer
// to a block of memory of size n bytes.  Check that the pointer
// lies within the process address space.
int
argptr(int n, char **pp, int size)
{
801055fa:	55                   	push   %ebp
801055fb:	89 e5                	mov    %esp,%ebp
801055fd:	83 ec 18             	sub    $0x18,%esp
  int i;
  
  if(argint(n, &i) < 0)
80105600:	8d 45 fc             	lea    -0x4(%ebp),%eax
80105603:	89 44 24 04          	mov    %eax,0x4(%esp)
80105607:	8b 45 08             	mov    0x8(%ebp),%eax
8010560a:	89 04 24             	mov    %eax,(%esp)
8010560d:	e8 b0 ff ff ff       	call   801055c2 <argint>
80105612:	85 c0                	test   %eax,%eax
80105614:	79 07                	jns    8010561d <argptr+0x23>
    return -1;
80105616:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
8010561b:	eb 3d                	jmp    8010565a <argptr+0x60>
  if((uint)i >= proc->sz || (uint)i+size > proc->sz)
8010561d:	8b 45 fc             	mov    -0x4(%ebp),%eax
80105620:	89 c2                	mov    %eax,%edx
80105622:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80105628:	8b 00                	mov    (%eax),%eax
8010562a:	39 c2                	cmp    %eax,%edx
8010562c:	73 16                	jae    80105644 <argptr+0x4a>
8010562e:	8b 45 fc             	mov    -0x4(%ebp),%eax
80105631:	89 c2                	mov    %eax,%edx
80105633:	8b 45 10             	mov    0x10(%ebp),%eax
80105636:	01 c2                	add    %eax,%edx
80105638:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
8010563e:	8b 00                	mov    (%eax),%eax
80105640:	39 c2                	cmp    %eax,%edx
80105642:	76 07                	jbe    8010564b <argptr+0x51>
    return -1;
80105644:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80105649:	eb 0f                	jmp    8010565a <argptr+0x60>
  *pp = (char*)i;
8010564b:	8b 45 fc             	mov    -0x4(%ebp),%eax
8010564e:	89 c2                	mov    %eax,%edx
80105650:	8b 45 0c             	mov    0xc(%ebp),%eax
80105653:	89 10                	mov    %edx,(%eax)
  return 0;
80105655:	b8 00 00 00 00       	mov    $0x0,%eax
}
8010565a:	c9                   	leave  
8010565b:	c3                   	ret    

8010565c <argstr>:
// Check that the pointer is valid and the string is nul-terminated.
// (There is no shared writable memory, so the string can't change
// between this check and being used by the kernel.)
int
argstr(int n, char **pp)
{
8010565c:	55                   	push   %ebp
8010565d:	89 e5                	mov    %esp,%ebp
8010565f:	83 ec 1c             	sub    $0x1c,%esp
  int addr;
  if(argint(n, &addr) < 0)
80105662:	8d 45 fc             	lea    -0x4(%ebp),%eax
80105665:	89 44 24 04          	mov    %eax,0x4(%esp)
80105669:	8b 45 08             	mov    0x8(%ebp),%eax
8010566c:	89 04 24             	mov    %eax,(%esp)
8010566f:	e8 4e ff ff ff       	call   801055c2 <argint>
80105674:	85 c0                	test   %eax,%eax
80105676:	79 07                	jns    8010567f <argstr+0x23>
    return -1;
80105678:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
8010567d:	eb 1e                	jmp    8010569d <argstr+0x41>
  return fetchstr(proc, addr, pp);
8010567f:	8b 45 fc             	mov    -0x4(%ebp),%eax
80105682:	89 c2                	mov    %eax,%edx
80105684:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
8010568a:	8b 4d 0c             	mov    0xc(%ebp),%ecx
8010568d:	89 4c 24 08          	mov    %ecx,0x8(%esp)
80105691:	89 54 24 04          	mov    %edx,0x4(%esp)
80105695:	89 04 24             	mov    %eax,(%esp)
80105698:	e8 c7 fe ff ff       	call   80105564 <fetchstr>
}
8010569d:	c9                   	leave  
8010569e:	c3                   	ret    

8010569f <syscall>:
[SYS_getTicks]   sys_getTicks,
};

void
syscall(void)
{
8010569f:	55                   	push   %ebp
801056a0:	89 e5                	mov    %esp,%ebp
801056a2:	53                   	push   %ebx
801056a3:	83 ec 24             	sub    $0x24,%esp
  int num;

  num = proc->tf->eax;
801056a6:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801056ac:	8b 40 18             	mov    0x18(%eax),%eax
801056af:	8b 40 1c             	mov    0x1c(%eax),%eax
801056b2:	89 45 f4             	mov    %eax,-0xc(%ebp)
  if(num >= 0 && num < SYS_open && syscalls[num]) {
801056b5:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
801056b9:	78 2e                	js     801056e9 <syscall+0x4a>
801056bb:	83 7d f4 0e          	cmpl   $0xe,-0xc(%ebp)
801056bf:	7f 28                	jg     801056e9 <syscall+0x4a>
801056c1:	8b 45 f4             	mov    -0xc(%ebp),%eax
801056c4:	8b 04 85 40 b0 10 80 	mov    -0x7fef4fc0(,%eax,4),%eax
801056cb:	85 c0                	test   %eax,%eax
801056cd:	74 1a                	je     801056e9 <syscall+0x4a>
    proc->tf->eax = syscalls[num]();
801056cf:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801056d5:	8b 58 18             	mov    0x18(%eax),%ebx
801056d8:	8b 45 f4             	mov    -0xc(%ebp),%eax
801056db:	8b 04 85 40 b0 10 80 	mov    -0x7fef4fc0(,%eax,4),%eax
801056e2:	ff d0                	call   *%eax
801056e4:	89 43 1c             	mov    %eax,0x1c(%ebx)
801056e7:	eb 73                	jmp    8010575c <syscall+0xbd>
  } else if (num >= SYS_open && num < NELEM(syscalls) && syscalls[num]) {
801056e9:	83 7d f4 0e          	cmpl   $0xe,-0xc(%ebp)
801056ed:	7e 30                	jle    8010571f <syscall+0x80>
801056ef:	8b 45 f4             	mov    -0xc(%ebp),%eax
801056f2:	83 f8 22             	cmp    $0x22,%eax
801056f5:	77 28                	ja     8010571f <syscall+0x80>
801056f7:	8b 45 f4             	mov    -0xc(%ebp),%eax
801056fa:	8b 04 85 40 b0 10 80 	mov    -0x7fef4fc0(,%eax,4),%eax
80105701:	85 c0                	test   %eax,%eax
80105703:	74 1a                	je     8010571f <syscall+0x80>
    proc->tf->eax = syscalls[num]();
80105705:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
8010570b:	8b 58 18             	mov    0x18(%eax),%ebx
8010570e:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105711:	8b 04 85 40 b0 10 80 	mov    -0x7fef4fc0(,%eax,4),%eax
80105718:	ff d0                	call   *%eax
8010571a:	89 43 1c             	mov    %eax,0x1c(%ebx)
8010571d:	eb 3d                	jmp    8010575c <syscall+0xbd>
  } else {
    cprintf("%d %s: unknown sys call %d\n",
            proc->pid, proc->name, num);
8010571f:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80105725:	8d 48 6c             	lea    0x6c(%eax),%ecx
80105728:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
  if(num >= 0 && num < SYS_open && syscalls[num]) {
    proc->tf->eax = syscalls[num]();
  } else if (num >= SYS_open && num < NELEM(syscalls) && syscalls[num]) {
    proc->tf->eax = syscalls[num]();
  } else {
    cprintf("%d %s: unknown sys call %d\n",
8010572e:	8b 40 10             	mov    0x10(%eax),%eax
80105731:	8b 55 f4             	mov    -0xc(%ebp),%edx
80105734:	89 54 24 0c          	mov    %edx,0xc(%esp)
80105738:	89 4c 24 08          	mov    %ecx,0x8(%esp)
8010573c:	89 44 24 04          	mov    %eax,0x4(%esp)
80105740:	c7 04 24 05 8b 10 80 	movl   $0x80108b05,(%esp)
80105747:	e8 5e ac ff ff       	call   801003aa <cprintf>
            proc->pid, proc->name, num);
    proc->tf->eax = -1;
8010574c:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80105752:	8b 40 18             	mov    0x18(%eax),%eax
80105755:	c7 40 1c ff ff ff ff 	movl   $0xffffffff,0x1c(%eax)
  }
}
8010575c:	83 c4 24             	add    $0x24,%esp
8010575f:	5b                   	pop    %ebx
80105760:	5d                   	pop    %ebp
80105761:	c3                   	ret    
80105762:	66 90                	xchg   %ax,%ax

80105764 <argfd>:

// Fetch the nth word-sized system call argument as a file descriptor
// and return both the descriptor and the corresponding struct file.
static int
argfd(int n, int *pfd, struct file **pf)
{
80105764:	55                   	push   %ebp
80105765:	89 e5                	mov    %esp,%ebp
80105767:	83 ec 28             	sub    $0x28,%esp
  int fd;
  struct file *f;

  if(argint(n, &fd) < 0)
8010576a:	8d 45 f0             	lea    -0x10(%ebp),%eax
8010576d:	89 44 24 04          	mov    %eax,0x4(%esp)
80105771:	8b 45 08             	mov    0x8(%ebp),%eax
80105774:	89 04 24             	mov    %eax,(%esp)
80105777:	e8 46 fe ff ff       	call   801055c2 <argint>
8010577c:	85 c0                	test   %eax,%eax
8010577e:	79 07                	jns    80105787 <argfd+0x23>
    return -1;
80105780:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80105785:	eb 50                	jmp    801057d7 <argfd+0x73>
  if(fd < 0 || fd >= NOFILE || (f=proc->ofile[fd]) == 0)
80105787:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010578a:	85 c0                	test   %eax,%eax
8010578c:	78 21                	js     801057af <argfd+0x4b>
8010578e:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105791:	83 f8 0f             	cmp    $0xf,%eax
80105794:	7f 19                	jg     801057af <argfd+0x4b>
80105796:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
8010579c:	8b 55 f0             	mov    -0x10(%ebp),%edx
8010579f:	83 c2 08             	add    $0x8,%edx
801057a2:	8b 44 90 08          	mov    0x8(%eax,%edx,4),%eax
801057a6:	89 45 f4             	mov    %eax,-0xc(%ebp)
801057a9:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
801057ad:	75 07                	jne    801057b6 <argfd+0x52>
    return -1;
801057af:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
801057b4:	eb 21                	jmp    801057d7 <argfd+0x73>
  if(pfd)
801057b6:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
801057ba:	74 08                	je     801057c4 <argfd+0x60>
    *pfd = fd;
801057bc:	8b 55 f0             	mov    -0x10(%ebp),%edx
801057bf:	8b 45 0c             	mov    0xc(%ebp),%eax
801057c2:	89 10                	mov    %edx,(%eax)
  if(pf)
801057c4:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
801057c8:	74 08                	je     801057d2 <argfd+0x6e>
    *pf = f;
801057ca:	8b 45 10             	mov    0x10(%ebp),%eax
801057cd:	8b 55 f4             	mov    -0xc(%ebp),%edx
801057d0:	89 10                	mov    %edx,(%eax)
  return 0;
801057d2:	b8 00 00 00 00       	mov    $0x0,%eax
}
801057d7:	c9                   	leave  
801057d8:	c3                   	ret    

801057d9 <fdalloc>:

// Allocate a file descriptor for the given file.
// Takes over file reference from caller on success.
static int
fdalloc(struct file *f)
{
801057d9:	55                   	push   %ebp
801057da:	89 e5                	mov    %esp,%ebp
801057dc:	83 ec 10             	sub    $0x10,%esp
  int fd;

  for(fd = 0; fd < NOFILE; fd++){
801057df:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
801057e6:	eb 30                	jmp    80105818 <fdalloc+0x3f>
    if(proc->ofile[fd] == 0){
801057e8:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801057ee:	8b 55 fc             	mov    -0x4(%ebp),%edx
801057f1:	83 c2 08             	add    $0x8,%edx
801057f4:	8b 44 90 08          	mov    0x8(%eax,%edx,4),%eax
801057f8:	85 c0                	test   %eax,%eax
801057fa:	75 18                	jne    80105814 <fdalloc+0x3b>
      proc->ofile[fd] = f;
801057fc:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80105802:	8b 55 fc             	mov    -0x4(%ebp),%edx
80105805:	8d 4a 08             	lea    0x8(%edx),%ecx
80105808:	8b 55 08             	mov    0x8(%ebp),%edx
8010580b:	89 54 88 08          	mov    %edx,0x8(%eax,%ecx,4)
      return fd;
8010580f:	8b 45 fc             	mov    -0x4(%ebp),%eax
80105812:	eb 0f                	jmp    80105823 <fdalloc+0x4a>
static int
fdalloc(struct file *f)
{
  int fd;

  for(fd = 0; fd < NOFILE; fd++){
80105814:	83 45 fc 01          	addl   $0x1,-0x4(%ebp)
80105818:	83 7d fc 0f          	cmpl   $0xf,-0x4(%ebp)
8010581c:	7e ca                	jle    801057e8 <fdalloc+0xf>
    if(proc->ofile[fd] == 0){
      proc->ofile[fd] = f;
      return fd;
    }
  }
  return -1;
8010581e:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
}
80105823:	c9                   	leave  
80105824:	c3                   	ret    

80105825 <sys_dup>:

int
sys_dup(void)
{
80105825:	55                   	push   %ebp
80105826:	89 e5                	mov    %esp,%ebp
80105828:	83 ec 28             	sub    $0x28,%esp
  struct file *f;
  int fd;
  
  if(argfd(0, 0, &f) < 0)
8010582b:	8d 45 f0             	lea    -0x10(%ebp),%eax
8010582e:	89 44 24 08          	mov    %eax,0x8(%esp)
80105832:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
80105839:	00 
8010583a:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
80105841:	e8 1e ff ff ff       	call   80105764 <argfd>
80105846:	85 c0                	test   %eax,%eax
80105848:	79 07                	jns    80105851 <sys_dup+0x2c>
    return -1;
8010584a:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
8010584f:	eb 29                	jmp    8010587a <sys_dup+0x55>
  if((fd=fdalloc(f)) < 0)
80105851:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105854:	89 04 24             	mov    %eax,(%esp)
80105857:	e8 7d ff ff ff       	call   801057d9 <fdalloc>
8010585c:	89 45 f4             	mov    %eax,-0xc(%ebp)
8010585f:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80105863:	79 07                	jns    8010586c <sys_dup+0x47>
    return -1;
80105865:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
8010586a:	eb 0e                	jmp    8010587a <sys_dup+0x55>
  filedup(f);
8010586c:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010586f:	89 04 24             	mov    %eax,(%esp)
80105872:	e8 2d b7 ff ff       	call   80100fa4 <filedup>
  return fd;
80105877:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
8010587a:	c9                   	leave  
8010587b:	c3                   	ret    

8010587c <sys_read>:

int
sys_read(void)
{
8010587c:	55                   	push   %ebp
8010587d:	89 e5                	mov    %esp,%ebp
8010587f:	83 ec 28             	sub    $0x28,%esp
  struct file *f;
  int n;
  char *p;

  if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0)
80105882:	8d 45 f4             	lea    -0xc(%ebp),%eax
80105885:	89 44 24 08          	mov    %eax,0x8(%esp)
80105889:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
80105890:	00 
80105891:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
80105898:	e8 c7 fe ff ff       	call   80105764 <argfd>
8010589d:	85 c0                	test   %eax,%eax
8010589f:	78 35                	js     801058d6 <sys_read+0x5a>
801058a1:	8d 45 f0             	lea    -0x10(%ebp),%eax
801058a4:	89 44 24 04          	mov    %eax,0x4(%esp)
801058a8:	c7 04 24 02 00 00 00 	movl   $0x2,(%esp)
801058af:	e8 0e fd ff ff       	call   801055c2 <argint>
801058b4:	85 c0                	test   %eax,%eax
801058b6:	78 1e                	js     801058d6 <sys_read+0x5a>
801058b8:	8b 45 f0             	mov    -0x10(%ebp),%eax
801058bb:	89 44 24 08          	mov    %eax,0x8(%esp)
801058bf:	8d 45 ec             	lea    -0x14(%ebp),%eax
801058c2:	89 44 24 04          	mov    %eax,0x4(%esp)
801058c6:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
801058cd:	e8 28 fd ff ff       	call   801055fa <argptr>
801058d2:	85 c0                	test   %eax,%eax
801058d4:	79 07                	jns    801058dd <sys_read+0x61>
    return -1;
801058d6:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
801058db:	eb 19                	jmp    801058f6 <sys_read+0x7a>
  return fileread(f, p, n);
801058dd:	8b 4d f0             	mov    -0x10(%ebp),%ecx
801058e0:	8b 55 ec             	mov    -0x14(%ebp),%edx
801058e3:	8b 45 f4             	mov    -0xc(%ebp),%eax
801058e6:	89 4c 24 08          	mov    %ecx,0x8(%esp)
801058ea:	89 54 24 04          	mov    %edx,0x4(%esp)
801058ee:	89 04 24             	mov    %eax,(%esp)
801058f1:	e8 1b b8 ff ff       	call   80101111 <fileread>
}
801058f6:	c9                   	leave  
801058f7:	c3                   	ret    

801058f8 <sys_write>:

int
sys_write(void)
{
801058f8:	55                   	push   %ebp
801058f9:	89 e5                	mov    %esp,%ebp
801058fb:	83 ec 28             	sub    $0x28,%esp
  struct file *f;
  int n;
  char *p;

  if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0)
801058fe:	8d 45 f4             	lea    -0xc(%ebp),%eax
80105901:	89 44 24 08          	mov    %eax,0x8(%esp)
80105905:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
8010590c:	00 
8010590d:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
80105914:	e8 4b fe ff ff       	call   80105764 <argfd>
80105919:	85 c0                	test   %eax,%eax
8010591b:	78 35                	js     80105952 <sys_write+0x5a>
8010591d:	8d 45 f0             	lea    -0x10(%ebp),%eax
80105920:	89 44 24 04          	mov    %eax,0x4(%esp)
80105924:	c7 04 24 02 00 00 00 	movl   $0x2,(%esp)
8010592b:	e8 92 fc ff ff       	call   801055c2 <argint>
80105930:	85 c0                	test   %eax,%eax
80105932:	78 1e                	js     80105952 <sys_write+0x5a>
80105934:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105937:	89 44 24 08          	mov    %eax,0x8(%esp)
8010593b:	8d 45 ec             	lea    -0x14(%ebp),%eax
8010593e:	89 44 24 04          	mov    %eax,0x4(%esp)
80105942:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
80105949:	e8 ac fc ff ff       	call   801055fa <argptr>
8010594e:	85 c0                	test   %eax,%eax
80105950:	79 07                	jns    80105959 <sys_write+0x61>
    return -1;
80105952:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80105957:	eb 19                	jmp    80105972 <sys_write+0x7a>
  return filewrite(f, p, n);
80105959:	8b 4d f0             	mov    -0x10(%ebp),%ecx
8010595c:	8b 55 ec             	mov    -0x14(%ebp),%edx
8010595f:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105962:	89 4c 24 08          	mov    %ecx,0x8(%esp)
80105966:	89 54 24 04          	mov    %edx,0x4(%esp)
8010596a:	89 04 24             	mov    %eax,(%esp)
8010596d:	e8 5b b8 ff ff       	call   801011cd <filewrite>
}
80105972:	c9                   	leave  
80105973:	c3                   	ret    

80105974 <sys_close>:

int
sys_close(void)
{
80105974:	55                   	push   %ebp
80105975:	89 e5                	mov    %esp,%ebp
80105977:	83 ec 28             	sub    $0x28,%esp
  int fd;
  struct file *f;
  
  if(argfd(0, &fd, &f) < 0)
8010597a:	8d 45 f0             	lea    -0x10(%ebp),%eax
8010597d:	89 44 24 08          	mov    %eax,0x8(%esp)
80105981:	8d 45 f4             	lea    -0xc(%ebp),%eax
80105984:	89 44 24 04          	mov    %eax,0x4(%esp)
80105988:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
8010598f:	e8 d0 fd ff ff       	call   80105764 <argfd>
80105994:	85 c0                	test   %eax,%eax
80105996:	79 07                	jns    8010599f <sys_close+0x2b>
    return -1;
80105998:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
8010599d:	eb 24                	jmp    801059c3 <sys_close+0x4f>
  proc->ofile[fd] = 0;
8010599f:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801059a5:	8b 55 f4             	mov    -0xc(%ebp),%edx
801059a8:	83 c2 08             	add    $0x8,%edx
801059ab:	c7 44 90 08 00 00 00 	movl   $0x0,0x8(%eax,%edx,4)
801059b2:	00 
  fileclose(f);
801059b3:	8b 45 f0             	mov    -0x10(%ebp),%eax
801059b6:	89 04 24             	mov    %eax,(%esp)
801059b9:	e8 2e b6 ff ff       	call   80100fec <fileclose>
  return 0;
801059be:	b8 00 00 00 00       	mov    $0x0,%eax
}
801059c3:	c9                   	leave  
801059c4:	c3                   	ret    

801059c5 <sys_fstat>:

int
sys_fstat(void)
{
801059c5:	55                   	push   %ebp
801059c6:	89 e5                	mov    %esp,%ebp
801059c8:	83 ec 28             	sub    $0x28,%esp
  struct file *f;
  struct stat *st;
  
  if(argfd(0, 0, &f) < 0 || argptr(1, (void*)&st, sizeof(*st)) < 0)
801059cb:	8d 45 f4             	lea    -0xc(%ebp),%eax
801059ce:	89 44 24 08          	mov    %eax,0x8(%esp)
801059d2:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
801059d9:	00 
801059da:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
801059e1:	e8 7e fd ff ff       	call   80105764 <argfd>
801059e6:	85 c0                	test   %eax,%eax
801059e8:	78 1f                	js     80105a09 <sys_fstat+0x44>
801059ea:	c7 44 24 08 14 00 00 	movl   $0x14,0x8(%esp)
801059f1:	00 
801059f2:	8d 45 f0             	lea    -0x10(%ebp),%eax
801059f5:	89 44 24 04          	mov    %eax,0x4(%esp)
801059f9:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
80105a00:	e8 f5 fb ff ff       	call   801055fa <argptr>
80105a05:	85 c0                	test   %eax,%eax
80105a07:	79 07                	jns    80105a10 <sys_fstat+0x4b>
    return -1;
80105a09:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80105a0e:	eb 12                	jmp    80105a22 <sys_fstat+0x5d>
  return filestat(f, st);
80105a10:	8b 55 f0             	mov    -0x10(%ebp),%edx
80105a13:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105a16:	89 54 24 04          	mov    %edx,0x4(%esp)
80105a1a:	89 04 24             	mov    %eax,(%esp)
80105a1d:	e8 a0 b6 ff ff       	call   801010c2 <filestat>
}
80105a22:	c9                   	leave  
80105a23:	c3                   	ret    

80105a24 <sys_link>:

// Create the path new as a link to the same inode as old.
int
sys_link(void)
{
80105a24:	55                   	push   %ebp
80105a25:	89 e5                	mov    %esp,%ebp
80105a27:	83 ec 38             	sub    $0x38,%esp
  char name[DIRSIZ], *new, *old;
  struct inode *dp, *ip;

  if(argstr(0, &old) < 0 || argstr(1, &new) < 0)
80105a2a:	8d 45 d8             	lea    -0x28(%ebp),%eax
80105a2d:	89 44 24 04          	mov    %eax,0x4(%esp)
80105a31:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
80105a38:	e8 1f fc ff ff       	call   8010565c <argstr>
80105a3d:	85 c0                	test   %eax,%eax
80105a3f:	78 17                	js     80105a58 <sys_link+0x34>
80105a41:	8d 45 dc             	lea    -0x24(%ebp),%eax
80105a44:	89 44 24 04          	mov    %eax,0x4(%esp)
80105a48:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
80105a4f:	e8 08 fc ff ff       	call   8010565c <argstr>
80105a54:	85 c0                	test   %eax,%eax
80105a56:	79 0a                	jns    80105a62 <sys_link+0x3e>
    return -1;
80105a58:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80105a5d:	e9 3c 01 00 00       	jmp    80105b9e <sys_link+0x17a>
  if((ip = namei(old)) == 0)
80105a62:	8b 45 d8             	mov    -0x28(%ebp),%eax
80105a65:	89 04 24             	mov    %eax,(%esp)
80105a68:	e8 e8 c9 ff ff       	call   80102455 <namei>
80105a6d:	89 45 f4             	mov    %eax,-0xc(%ebp)
80105a70:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80105a74:	75 0a                	jne    80105a80 <sys_link+0x5c>
    return -1;
80105a76:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80105a7b:	e9 1e 01 00 00       	jmp    80105b9e <sys_link+0x17a>

  begin_trans();
80105a80:	e8 eb d7 ff ff       	call   80103270 <begin_trans>

  ilock(ip);
80105a85:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105a88:	89 04 24             	mov    %eax,(%esp)
80105a8b:	e8 04 be ff ff       	call   80101894 <ilock>
  if(ip->type == T_DIR){
80105a90:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105a93:	0f b7 40 10          	movzwl 0x10(%eax),%eax
80105a97:	66 83 f8 01          	cmp    $0x1,%ax
80105a9b:	75 1a                	jne    80105ab7 <sys_link+0x93>
    iunlockput(ip);
80105a9d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105aa0:	89 04 24             	mov    %eax,(%esp)
80105aa3:	e8 70 c0 ff ff       	call   80101b18 <iunlockput>
    commit_trans();
80105aa8:	e8 0c d8 ff ff       	call   801032b9 <commit_trans>
    return -1;
80105aad:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80105ab2:	e9 e7 00 00 00       	jmp    80105b9e <sys_link+0x17a>
  }

  ip->nlink++;
80105ab7:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105aba:	0f b7 40 16          	movzwl 0x16(%eax),%eax
80105abe:	8d 50 01             	lea    0x1(%eax),%edx
80105ac1:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105ac4:	66 89 50 16          	mov    %dx,0x16(%eax)
  iupdate(ip);
80105ac8:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105acb:	89 04 24             	mov    %eax,(%esp)
80105ace:	e8 05 bc ff ff       	call   801016d8 <iupdate>
  iunlock(ip);
80105ad3:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105ad6:	89 04 24             	mov    %eax,(%esp)
80105ad9:	e8 04 bf ff ff       	call   801019e2 <iunlock>

  if((dp = nameiparent(new, name)) == 0)
80105ade:	8b 45 dc             	mov    -0x24(%ebp),%eax
80105ae1:	8d 55 e2             	lea    -0x1e(%ebp),%edx
80105ae4:	89 54 24 04          	mov    %edx,0x4(%esp)
80105ae8:	89 04 24             	mov    %eax,(%esp)
80105aeb:	e8 87 c9 ff ff       	call   80102477 <nameiparent>
80105af0:	89 45 f0             	mov    %eax,-0x10(%ebp)
80105af3:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
80105af7:	74 68                	je     80105b61 <sys_link+0x13d>
    goto bad;
  ilock(dp);
80105af9:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105afc:	89 04 24             	mov    %eax,(%esp)
80105aff:	e8 90 bd ff ff       	call   80101894 <ilock>
  if(dp->dev != ip->dev || dirlink(dp, name, ip->inum) < 0){
80105b04:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105b07:	8b 10                	mov    (%eax),%edx
80105b09:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105b0c:	8b 00                	mov    (%eax),%eax
80105b0e:	39 c2                	cmp    %eax,%edx
80105b10:	75 20                	jne    80105b32 <sys_link+0x10e>
80105b12:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105b15:	8b 40 04             	mov    0x4(%eax),%eax
80105b18:	89 44 24 08          	mov    %eax,0x8(%esp)
80105b1c:	8d 45 e2             	lea    -0x1e(%ebp),%eax
80105b1f:	89 44 24 04          	mov    %eax,0x4(%esp)
80105b23:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105b26:	89 04 24             	mov    %eax,(%esp)
80105b29:	e8 64 c6 ff ff       	call   80102192 <dirlink>
80105b2e:	85 c0                	test   %eax,%eax
80105b30:	79 0d                	jns    80105b3f <sys_link+0x11b>
    iunlockput(dp);
80105b32:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105b35:	89 04 24             	mov    %eax,(%esp)
80105b38:	e8 db bf ff ff       	call   80101b18 <iunlockput>
    goto bad;
80105b3d:	eb 23                	jmp    80105b62 <sys_link+0x13e>
  }
  iunlockput(dp);
80105b3f:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105b42:	89 04 24             	mov    %eax,(%esp)
80105b45:	e8 ce bf ff ff       	call   80101b18 <iunlockput>
  iput(ip);
80105b4a:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105b4d:	89 04 24             	mov    %eax,(%esp)
80105b50:	e8 f2 be ff ff       	call   80101a47 <iput>

  commit_trans();
80105b55:	e8 5f d7 ff ff       	call   801032b9 <commit_trans>

  return 0;
80105b5a:	b8 00 00 00 00       	mov    $0x0,%eax
80105b5f:	eb 3d                	jmp    80105b9e <sys_link+0x17a>
  ip->nlink++;
  iupdate(ip);
  iunlock(ip);

  if((dp = nameiparent(new, name)) == 0)
    goto bad;
80105b61:	90                   	nop
  commit_trans();

  return 0;

bad:
  ilock(ip);
80105b62:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105b65:	89 04 24             	mov    %eax,(%esp)
80105b68:	e8 27 bd ff ff       	call   80101894 <ilock>
  ip->nlink--;
80105b6d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105b70:	0f b7 40 16          	movzwl 0x16(%eax),%eax
80105b74:	8d 50 ff             	lea    -0x1(%eax),%edx
80105b77:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105b7a:	66 89 50 16          	mov    %dx,0x16(%eax)
  iupdate(ip);
80105b7e:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105b81:	89 04 24             	mov    %eax,(%esp)
80105b84:	e8 4f bb ff ff       	call   801016d8 <iupdate>
  iunlockput(ip);
80105b89:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105b8c:	89 04 24             	mov    %eax,(%esp)
80105b8f:	e8 84 bf ff ff       	call   80101b18 <iunlockput>
  commit_trans();
80105b94:	e8 20 d7 ff ff       	call   801032b9 <commit_trans>
  return -1;
80105b99:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
}
80105b9e:	c9                   	leave  
80105b9f:	c3                   	ret    

80105ba0 <isdirempty>:

// Is the directory dp empty except for "." and ".." ?
static int
isdirempty(struct inode *dp)
{
80105ba0:	55                   	push   %ebp
80105ba1:	89 e5                	mov    %esp,%ebp
80105ba3:	83 ec 38             	sub    $0x38,%esp
  int off;
  struct dirent de;

  for(off=2*sizeof(de); off<dp->size; off+=sizeof(de)){
80105ba6:	c7 45 f4 20 00 00 00 	movl   $0x20,-0xc(%ebp)
80105bad:	eb 4b                	jmp    80105bfa <isdirempty+0x5a>
    if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
80105baf:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105bb2:	c7 44 24 0c 10 00 00 	movl   $0x10,0xc(%esp)
80105bb9:	00 
80105bba:	89 44 24 08          	mov    %eax,0x8(%esp)
80105bbe:	8d 45 e4             	lea    -0x1c(%ebp),%eax
80105bc1:	89 44 24 04          	mov    %eax,0x4(%esp)
80105bc5:	8b 45 08             	mov    0x8(%ebp),%eax
80105bc8:	89 04 24             	mov    %eax,(%esp)
80105bcb:	e8 d1 c1 ff ff       	call   80101da1 <readi>
80105bd0:	83 f8 10             	cmp    $0x10,%eax
80105bd3:	74 0c                	je     80105be1 <isdirempty+0x41>
      panic("isdirempty: readi");
80105bd5:	c7 04 24 21 8b 10 80 	movl   $0x80108b21,(%esp)
80105bdc:	e8 65 a9 ff ff       	call   80100546 <panic>
    if(de.inum != 0)
80105be1:	0f b7 45 e4          	movzwl -0x1c(%ebp),%eax
80105be5:	66 85 c0             	test   %ax,%ax
80105be8:	74 07                	je     80105bf1 <isdirempty+0x51>
      return 0;
80105bea:	b8 00 00 00 00       	mov    $0x0,%eax
80105bef:	eb 1b                	jmp    80105c0c <isdirempty+0x6c>
isdirempty(struct inode *dp)
{
  int off;
  struct dirent de;

  for(off=2*sizeof(de); off<dp->size; off+=sizeof(de)){
80105bf1:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105bf4:	83 c0 10             	add    $0x10,%eax
80105bf7:	89 45 f4             	mov    %eax,-0xc(%ebp)
80105bfa:	8b 55 f4             	mov    -0xc(%ebp),%edx
80105bfd:	8b 45 08             	mov    0x8(%ebp),%eax
80105c00:	8b 40 18             	mov    0x18(%eax),%eax
80105c03:	39 c2                	cmp    %eax,%edx
80105c05:	72 a8                	jb     80105baf <isdirempty+0xf>
    if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
      panic("isdirempty: readi");
    if(de.inum != 0)
      return 0;
  }
  return 1;
80105c07:	b8 01 00 00 00       	mov    $0x1,%eax
}
80105c0c:	c9                   	leave  
80105c0d:	c3                   	ret    

80105c0e <sys_unlink>:

//PAGEBREAK!
int
sys_unlink(void)
{
80105c0e:	55                   	push   %ebp
80105c0f:	89 e5                	mov    %esp,%ebp
80105c11:	83 ec 48             	sub    $0x48,%esp
  struct inode *ip, *dp;
  struct dirent de;
  char name[DIRSIZ], *path;
  uint off;

  if(argstr(0, &path) < 0)
80105c14:	8d 45 cc             	lea    -0x34(%ebp),%eax
80105c17:	89 44 24 04          	mov    %eax,0x4(%esp)
80105c1b:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
80105c22:	e8 35 fa ff ff       	call   8010565c <argstr>
80105c27:	85 c0                	test   %eax,%eax
80105c29:	79 0a                	jns    80105c35 <sys_unlink+0x27>
    return -1;
80105c2b:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80105c30:	e9 aa 01 00 00       	jmp    80105ddf <sys_unlink+0x1d1>
  if((dp = nameiparent(path, name)) == 0)
80105c35:	8b 45 cc             	mov    -0x34(%ebp),%eax
80105c38:	8d 55 d2             	lea    -0x2e(%ebp),%edx
80105c3b:	89 54 24 04          	mov    %edx,0x4(%esp)
80105c3f:	89 04 24             	mov    %eax,(%esp)
80105c42:	e8 30 c8 ff ff       	call   80102477 <nameiparent>
80105c47:	89 45 f4             	mov    %eax,-0xc(%ebp)
80105c4a:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80105c4e:	75 0a                	jne    80105c5a <sys_unlink+0x4c>
    return -1;
80105c50:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80105c55:	e9 85 01 00 00       	jmp    80105ddf <sys_unlink+0x1d1>

  begin_trans();
80105c5a:	e8 11 d6 ff ff       	call   80103270 <begin_trans>

  ilock(dp);
80105c5f:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105c62:	89 04 24             	mov    %eax,(%esp)
80105c65:	e8 2a bc ff ff       	call   80101894 <ilock>

  // Cannot unlink "." or "..".
  if(namecmp(name, ".") == 0 || namecmp(name, "..") == 0)
80105c6a:	c7 44 24 04 33 8b 10 	movl   $0x80108b33,0x4(%esp)
80105c71:	80 
80105c72:	8d 45 d2             	lea    -0x2e(%ebp),%eax
80105c75:	89 04 24             	mov    %eax,(%esp)
80105c78:	e8 2b c4 ff ff       	call   801020a8 <namecmp>
80105c7d:	85 c0                	test   %eax,%eax
80105c7f:	0f 84 45 01 00 00    	je     80105dca <sys_unlink+0x1bc>
80105c85:	c7 44 24 04 35 8b 10 	movl   $0x80108b35,0x4(%esp)
80105c8c:	80 
80105c8d:	8d 45 d2             	lea    -0x2e(%ebp),%eax
80105c90:	89 04 24             	mov    %eax,(%esp)
80105c93:	e8 10 c4 ff ff       	call   801020a8 <namecmp>
80105c98:	85 c0                	test   %eax,%eax
80105c9a:	0f 84 2a 01 00 00    	je     80105dca <sys_unlink+0x1bc>
    goto bad;

  if((ip = dirlookup(dp, name, &off)) == 0)
80105ca0:	8d 45 c8             	lea    -0x38(%ebp),%eax
80105ca3:	89 44 24 08          	mov    %eax,0x8(%esp)
80105ca7:	8d 45 d2             	lea    -0x2e(%ebp),%eax
80105caa:	89 44 24 04          	mov    %eax,0x4(%esp)
80105cae:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105cb1:	89 04 24             	mov    %eax,(%esp)
80105cb4:	e8 11 c4 ff ff       	call   801020ca <dirlookup>
80105cb9:	89 45 f0             	mov    %eax,-0x10(%ebp)
80105cbc:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
80105cc0:	0f 84 03 01 00 00    	je     80105dc9 <sys_unlink+0x1bb>
    goto bad;
  ilock(ip);
80105cc6:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105cc9:	89 04 24             	mov    %eax,(%esp)
80105ccc:	e8 c3 bb ff ff       	call   80101894 <ilock>

  if(ip->nlink < 1)
80105cd1:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105cd4:	0f b7 40 16          	movzwl 0x16(%eax),%eax
80105cd8:	66 85 c0             	test   %ax,%ax
80105cdb:	7f 0c                	jg     80105ce9 <sys_unlink+0xdb>
    panic("unlink: nlink < 1");
80105cdd:	c7 04 24 38 8b 10 80 	movl   $0x80108b38,(%esp)
80105ce4:	e8 5d a8 ff ff       	call   80100546 <panic>
  if(ip->type == T_DIR && !isdirempty(ip)){
80105ce9:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105cec:	0f b7 40 10          	movzwl 0x10(%eax),%eax
80105cf0:	66 83 f8 01          	cmp    $0x1,%ax
80105cf4:	75 1f                	jne    80105d15 <sys_unlink+0x107>
80105cf6:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105cf9:	89 04 24             	mov    %eax,(%esp)
80105cfc:	e8 9f fe ff ff       	call   80105ba0 <isdirempty>
80105d01:	85 c0                	test   %eax,%eax
80105d03:	75 10                	jne    80105d15 <sys_unlink+0x107>
    iunlockput(ip);
80105d05:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105d08:	89 04 24             	mov    %eax,(%esp)
80105d0b:	e8 08 be ff ff       	call   80101b18 <iunlockput>
    goto bad;
80105d10:	e9 b5 00 00 00       	jmp    80105dca <sys_unlink+0x1bc>
  }

  memset(&de, 0, sizeof(de));
80105d15:	c7 44 24 08 10 00 00 	movl   $0x10,0x8(%esp)
80105d1c:	00 
80105d1d:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
80105d24:	00 
80105d25:	8d 45 e0             	lea    -0x20(%ebp),%eax
80105d28:	89 04 24             	mov    %eax,(%esp)
80105d2b:	e8 42 f5 ff ff       	call   80105272 <memset>
  if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
80105d30:	8b 45 c8             	mov    -0x38(%ebp),%eax
80105d33:	c7 44 24 0c 10 00 00 	movl   $0x10,0xc(%esp)
80105d3a:	00 
80105d3b:	89 44 24 08          	mov    %eax,0x8(%esp)
80105d3f:	8d 45 e0             	lea    -0x20(%ebp),%eax
80105d42:	89 44 24 04          	mov    %eax,0x4(%esp)
80105d46:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105d49:	89 04 24             	mov    %eax,(%esp)
80105d4c:	e8 be c1 ff ff       	call   80101f0f <writei>
80105d51:	83 f8 10             	cmp    $0x10,%eax
80105d54:	74 0c                	je     80105d62 <sys_unlink+0x154>
    panic("unlink: writei");
80105d56:	c7 04 24 4a 8b 10 80 	movl   $0x80108b4a,(%esp)
80105d5d:	e8 e4 a7 ff ff       	call   80100546 <panic>
  if(ip->type == T_DIR){
80105d62:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105d65:	0f b7 40 10          	movzwl 0x10(%eax),%eax
80105d69:	66 83 f8 01          	cmp    $0x1,%ax
80105d6d:	75 1c                	jne    80105d8b <sys_unlink+0x17d>
    dp->nlink--;
80105d6f:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105d72:	0f b7 40 16          	movzwl 0x16(%eax),%eax
80105d76:	8d 50 ff             	lea    -0x1(%eax),%edx
80105d79:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105d7c:	66 89 50 16          	mov    %dx,0x16(%eax)
    iupdate(dp);
80105d80:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105d83:	89 04 24             	mov    %eax,(%esp)
80105d86:	e8 4d b9 ff ff       	call   801016d8 <iupdate>
  }
  iunlockput(dp);
80105d8b:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105d8e:	89 04 24             	mov    %eax,(%esp)
80105d91:	e8 82 bd ff ff       	call   80101b18 <iunlockput>

  ip->nlink--;
80105d96:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105d99:	0f b7 40 16          	movzwl 0x16(%eax),%eax
80105d9d:	8d 50 ff             	lea    -0x1(%eax),%edx
80105da0:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105da3:	66 89 50 16          	mov    %dx,0x16(%eax)
  iupdate(ip);
80105da7:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105daa:	89 04 24             	mov    %eax,(%esp)
80105dad:	e8 26 b9 ff ff       	call   801016d8 <iupdate>
  iunlockput(ip);
80105db2:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105db5:	89 04 24             	mov    %eax,(%esp)
80105db8:	e8 5b bd ff ff       	call   80101b18 <iunlockput>

  commit_trans();
80105dbd:	e8 f7 d4 ff ff       	call   801032b9 <commit_trans>

  return 0;
80105dc2:	b8 00 00 00 00       	mov    $0x0,%eax
80105dc7:	eb 16                	jmp    80105ddf <sys_unlink+0x1d1>
  // Cannot unlink "." or "..".
  if(namecmp(name, ".") == 0 || namecmp(name, "..") == 0)
    goto bad;

  if((ip = dirlookup(dp, name, &off)) == 0)
    goto bad;
80105dc9:	90                   	nop
  commit_trans();

  return 0;

bad:
  iunlockput(dp);
80105dca:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105dcd:	89 04 24             	mov    %eax,(%esp)
80105dd0:	e8 43 bd ff ff       	call   80101b18 <iunlockput>
  commit_trans();
80105dd5:	e8 df d4 ff ff       	call   801032b9 <commit_trans>
  return -1;
80105dda:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
}
80105ddf:	c9                   	leave  
80105de0:	c3                   	ret    

80105de1 <create>:

static struct inode*
create(char *path, short type, short major, short minor)
{
80105de1:	55                   	push   %ebp
80105de2:	89 e5                	mov    %esp,%ebp
80105de4:	83 ec 48             	sub    $0x48,%esp
80105de7:	8b 4d 0c             	mov    0xc(%ebp),%ecx
80105dea:	8b 55 10             	mov    0x10(%ebp),%edx
80105ded:	8b 45 14             	mov    0x14(%ebp),%eax
80105df0:	66 89 4d d4          	mov    %cx,-0x2c(%ebp)
80105df4:	66 89 55 d0          	mov    %dx,-0x30(%ebp)
80105df8:	66 89 45 cc          	mov    %ax,-0x34(%ebp)
  uint off;
  struct inode *ip, *dp;
  char name[DIRSIZ];

  if((dp = nameiparent(path, name)) == 0)
80105dfc:	8d 45 de             	lea    -0x22(%ebp),%eax
80105dff:	89 44 24 04          	mov    %eax,0x4(%esp)
80105e03:	8b 45 08             	mov    0x8(%ebp),%eax
80105e06:	89 04 24             	mov    %eax,(%esp)
80105e09:	e8 69 c6 ff ff       	call   80102477 <nameiparent>
80105e0e:	89 45 f4             	mov    %eax,-0xc(%ebp)
80105e11:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80105e15:	75 0a                	jne    80105e21 <create+0x40>
    return 0;
80105e17:	b8 00 00 00 00       	mov    $0x0,%eax
80105e1c:	e9 7e 01 00 00       	jmp    80105f9f <create+0x1be>
  ilock(dp);
80105e21:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105e24:	89 04 24             	mov    %eax,(%esp)
80105e27:	e8 68 ba ff ff       	call   80101894 <ilock>

  if((ip = dirlookup(dp, name, &off)) != 0){
80105e2c:	8d 45 ec             	lea    -0x14(%ebp),%eax
80105e2f:	89 44 24 08          	mov    %eax,0x8(%esp)
80105e33:	8d 45 de             	lea    -0x22(%ebp),%eax
80105e36:	89 44 24 04          	mov    %eax,0x4(%esp)
80105e3a:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105e3d:	89 04 24             	mov    %eax,(%esp)
80105e40:	e8 85 c2 ff ff       	call   801020ca <dirlookup>
80105e45:	89 45 f0             	mov    %eax,-0x10(%ebp)
80105e48:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
80105e4c:	74 47                	je     80105e95 <create+0xb4>
    iunlockput(dp);
80105e4e:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105e51:	89 04 24             	mov    %eax,(%esp)
80105e54:	e8 bf bc ff ff       	call   80101b18 <iunlockput>
    ilock(ip);
80105e59:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105e5c:	89 04 24             	mov    %eax,(%esp)
80105e5f:	e8 30 ba ff ff       	call   80101894 <ilock>
    if(type == T_FILE && ip->type == T_FILE)
80105e64:	66 83 7d d4 02       	cmpw   $0x2,-0x2c(%ebp)
80105e69:	75 15                	jne    80105e80 <create+0x9f>
80105e6b:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105e6e:	0f b7 40 10          	movzwl 0x10(%eax),%eax
80105e72:	66 83 f8 02          	cmp    $0x2,%ax
80105e76:	75 08                	jne    80105e80 <create+0x9f>
      return ip;
80105e78:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105e7b:	e9 1f 01 00 00       	jmp    80105f9f <create+0x1be>
    iunlockput(ip);
80105e80:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105e83:	89 04 24             	mov    %eax,(%esp)
80105e86:	e8 8d bc ff ff       	call   80101b18 <iunlockput>
    return 0;
80105e8b:	b8 00 00 00 00       	mov    $0x0,%eax
80105e90:	e9 0a 01 00 00       	jmp    80105f9f <create+0x1be>
  }

  if((ip = ialloc(dp->dev, type)) == 0)
80105e95:	0f bf 55 d4          	movswl -0x2c(%ebp),%edx
80105e99:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105e9c:	8b 00                	mov    (%eax),%eax
80105e9e:	89 54 24 04          	mov    %edx,0x4(%esp)
80105ea2:	89 04 24             	mov    %eax,(%esp)
80105ea5:	e8 4f b7 ff ff       	call   801015f9 <ialloc>
80105eaa:	89 45 f0             	mov    %eax,-0x10(%ebp)
80105ead:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
80105eb1:	75 0c                	jne    80105ebf <create+0xde>
    panic("create: ialloc");
80105eb3:	c7 04 24 59 8b 10 80 	movl   $0x80108b59,(%esp)
80105eba:	e8 87 a6 ff ff       	call   80100546 <panic>

  ilock(ip);
80105ebf:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105ec2:	89 04 24             	mov    %eax,(%esp)
80105ec5:	e8 ca b9 ff ff       	call   80101894 <ilock>
  ip->major = major;
80105eca:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105ecd:	0f b7 55 d0          	movzwl -0x30(%ebp),%edx
80105ed1:	66 89 50 12          	mov    %dx,0x12(%eax)
  ip->minor = minor;
80105ed5:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105ed8:	0f b7 55 cc          	movzwl -0x34(%ebp),%edx
80105edc:	66 89 50 14          	mov    %dx,0x14(%eax)
  ip->nlink = 1;
80105ee0:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105ee3:	66 c7 40 16 01 00    	movw   $0x1,0x16(%eax)
  iupdate(ip);
80105ee9:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105eec:	89 04 24             	mov    %eax,(%esp)
80105eef:	e8 e4 b7 ff ff       	call   801016d8 <iupdate>

  if(type == T_DIR){  // Create . and .. entries.
80105ef4:	66 83 7d d4 01       	cmpw   $0x1,-0x2c(%ebp)
80105ef9:	75 6a                	jne    80105f65 <create+0x184>
    dp->nlink++;  // for ".."
80105efb:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105efe:	0f b7 40 16          	movzwl 0x16(%eax),%eax
80105f02:	8d 50 01             	lea    0x1(%eax),%edx
80105f05:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105f08:	66 89 50 16          	mov    %dx,0x16(%eax)
    iupdate(dp);
80105f0c:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105f0f:	89 04 24             	mov    %eax,(%esp)
80105f12:	e8 c1 b7 ff ff       	call   801016d8 <iupdate>
    // No ip->nlink++ for ".": avoid cyclic ref count.
    if(dirlink(ip, ".", ip->inum) < 0 || dirlink(ip, "..", dp->inum) < 0)
80105f17:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105f1a:	8b 40 04             	mov    0x4(%eax),%eax
80105f1d:	89 44 24 08          	mov    %eax,0x8(%esp)
80105f21:	c7 44 24 04 33 8b 10 	movl   $0x80108b33,0x4(%esp)
80105f28:	80 
80105f29:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105f2c:	89 04 24             	mov    %eax,(%esp)
80105f2f:	e8 5e c2 ff ff       	call   80102192 <dirlink>
80105f34:	85 c0                	test   %eax,%eax
80105f36:	78 21                	js     80105f59 <create+0x178>
80105f38:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105f3b:	8b 40 04             	mov    0x4(%eax),%eax
80105f3e:	89 44 24 08          	mov    %eax,0x8(%esp)
80105f42:	c7 44 24 04 35 8b 10 	movl   $0x80108b35,0x4(%esp)
80105f49:	80 
80105f4a:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105f4d:	89 04 24             	mov    %eax,(%esp)
80105f50:	e8 3d c2 ff ff       	call   80102192 <dirlink>
80105f55:	85 c0                	test   %eax,%eax
80105f57:	79 0c                	jns    80105f65 <create+0x184>
      panic("create dots");
80105f59:	c7 04 24 68 8b 10 80 	movl   $0x80108b68,(%esp)
80105f60:	e8 e1 a5 ff ff       	call   80100546 <panic>
  }

  if(dirlink(dp, name, ip->inum) < 0)
80105f65:	8b 45 f0             	mov    -0x10(%ebp),%eax
80105f68:	8b 40 04             	mov    0x4(%eax),%eax
80105f6b:	89 44 24 08          	mov    %eax,0x8(%esp)
80105f6f:	8d 45 de             	lea    -0x22(%ebp),%eax
80105f72:	89 44 24 04          	mov    %eax,0x4(%esp)
80105f76:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105f79:	89 04 24             	mov    %eax,(%esp)
80105f7c:	e8 11 c2 ff ff       	call   80102192 <dirlink>
80105f81:	85 c0                	test   %eax,%eax
80105f83:	79 0c                	jns    80105f91 <create+0x1b0>
    panic("create: dirlink");
80105f85:	c7 04 24 74 8b 10 80 	movl   $0x80108b74,(%esp)
80105f8c:	e8 b5 a5 ff ff       	call   80100546 <panic>

  iunlockput(dp);
80105f91:	8b 45 f4             	mov    -0xc(%ebp),%eax
80105f94:	89 04 24             	mov    %eax,(%esp)
80105f97:	e8 7c bb ff ff       	call   80101b18 <iunlockput>

  return ip;
80105f9c:	8b 45 f0             	mov    -0x10(%ebp),%eax
}
80105f9f:	c9                   	leave  
80105fa0:	c3                   	ret    

80105fa1 <sys_open>:

int
sys_open(void)
{
80105fa1:	55                   	push   %ebp
80105fa2:	89 e5                	mov    %esp,%ebp
80105fa4:	83 ec 38             	sub    $0x38,%esp
  char *path;
  int fd, omode;
  struct file *f;
  struct inode *ip;

  if(argstr(0, &path) < 0 || argint(1, &omode) < 0)
80105fa7:	8d 45 e8             	lea    -0x18(%ebp),%eax
80105faa:	89 44 24 04          	mov    %eax,0x4(%esp)
80105fae:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
80105fb5:	e8 a2 f6 ff ff       	call   8010565c <argstr>
80105fba:	85 c0                	test   %eax,%eax
80105fbc:	78 17                	js     80105fd5 <sys_open+0x34>
80105fbe:	8d 45 e4             	lea    -0x1c(%ebp),%eax
80105fc1:	89 44 24 04          	mov    %eax,0x4(%esp)
80105fc5:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
80105fcc:	e8 f1 f5 ff ff       	call   801055c2 <argint>
80105fd1:	85 c0                	test   %eax,%eax
80105fd3:	79 0a                	jns    80105fdf <sys_open+0x3e>
    return -1;
80105fd5:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80105fda:	e9 48 01 00 00       	jmp    80106127 <sys_open+0x186>
  if(omode & O_CREATE){
80105fdf:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80105fe2:	25 00 02 00 00       	and    $0x200,%eax
80105fe7:	85 c0                	test   %eax,%eax
80105fe9:	74 40                	je     8010602b <sys_open+0x8a>
    begin_trans();
80105feb:	e8 80 d2 ff ff       	call   80103270 <begin_trans>
    ip = create(path, T_FILE, 0, 0);
80105ff0:	8b 45 e8             	mov    -0x18(%ebp),%eax
80105ff3:	c7 44 24 0c 00 00 00 	movl   $0x0,0xc(%esp)
80105ffa:	00 
80105ffb:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
80106002:	00 
80106003:	c7 44 24 04 02 00 00 	movl   $0x2,0x4(%esp)
8010600a:	00 
8010600b:	89 04 24             	mov    %eax,(%esp)
8010600e:	e8 ce fd ff ff       	call   80105de1 <create>
80106013:	89 45 f4             	mov    %eax,-0xc(%ebp)
    commit_trans();
80106016:	e8 9e d2 ff ff       	call   801032b9 <commit_trans>
    if(ip == 0)
8010601b:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
8010601f:	75 5c                	jne    8010607d <sys_open+0xdc>
      return -1;
80106021:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80106026:	e9 fc 00 00 00       	jmp    80106127 <sys_open+0x186>
  } else {
    if((ip = namei(path)) == 0)
8010602b:	8b 45 e8             	mov    -0x18(%ebp),%eax
8010602e:	89 04 24             	mov    %eax,(%esp)
80106031:	e8 1f c4 ff ff       	call   80102455 <namei>
80106036:	89 45 f4             	mov    %eax,-0xc(%ebp)
80106039:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
8010603d:	75 0a                	jne    80106049 <sys_open+0xa8>
      return -1;
8010603f:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80106044:	e9 de 00 00 00       	jmp    80106127 <sys_open+0x186>
    ilock(ip);
80106049:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010604c:	89 04 24             	mov    %eax,(%esp)
8010604f:	e8 40 b8 ff ff       	call   80101894 <ilock>
    if(ip->type == T_DIR && omode != O_RDONLY){
80106054:	8b 45 f4             	mov    -0xc(%ebp),%eax
80106057:	0f b7 40 10          	movzwl 0x10(%eax),%eax
8010605b:	66 83 f8 01          	cmp    $0x1,%ax
8010605f:	75 1c                	jne    8010607d <sys_open+0xdc>
80106061:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80106064:	85 c0                	test   %eax,%eax
80106066:	74 15                	je     8010607d <sys_open+0xdc>
      iunlockput(ip);
80106068:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010606b:	89 04 24             	mov    %eax,(%esp)
8010606e:	e8 a5 ba ff ff       	call   80101b18 <iunlockput>
      return -1;
80106073:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80106078:	e9 aa 00 00 00       	jmp    80106127 <sys_open+0x186>
    }
  }

  if((f = filealloc()) == 0 || (fd = fdalloc(f)) < 0){
8010607d:	e8 c2 ae ff ff       	call   80100f44 <filealloc>
80106082:	89 45 f0             	mov    %eax,-0x10(%ebp)
80106085:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
80106089:	74 14                	je     8010609f <sys_open+0xfe>
8010608b:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010608e:	89 04 24             	mov    %eax,(%esp)
80106091:	e8 43 f7 ff ff       	call   801057d9 <fdalloc>
80106096:	89 45 ec             	mov    %eax,-0x14(%ebp)
80106099:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
8010609d:	79 23                	jns    801060c2 <sys_open+0x121>
    if(f)
8010609f:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
801060a3:	74 0b                	je     801060b0 <sys_open+0x10f>
      fileclose(f);
801060a5:	8b 45 f0             	mov    -0x10(%ebp),%eax
801060a8:	89 04 24             	mov    %eax,(%esp)
801060ab:	e8 3c af ff ff       	call   80100fec <fileclose>
    iunlockput(ip);
801060b0:	8b 45 f4             	mov    -0xc(%ebp),%eax
801060b3:	89 04 24             	mov    %eax,(%esp)
801060b6:	e8 5d ba ff ff       	call   80101b18 <iunlockput>
    return -1;
801060bb:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
801060c0:	eb 65                	jmp    80106127 <sys_open+0x186>
  }
  iunlock(ip);
801060c2:	8b 45 f4             	mov    -0xc(%ebp),%eax
801060c5:	89 04 24             	mov    %eax,(%esp)
801060c8:	e8 15 b9 ff ff       	call   801019e2 <iunlock>

  f->type = FD_INODE;
801060cd:	8b 45 f0             	mov    -0x10(%ebp),%eax
801060d0:	c7 00 02 00 00 00    	movl   $0x2,(%eax)
  f->ip = ip;
801060d6:	8b 45 f0             	mov    -0x10(%ebp),%eax
801060d9:	8b 55 f4             	mov    -0xc(%ebp),%edx
801060dc:	89 50 10             	mov    %edx,0x10(%eax)
  f->off = 0;
801060df:	8b 45 f0             	mov    -0x10(%ebp),%eax
801060e2:	c7 40 14 00 00 00 00 	movl   $0x0,0x14(%eax)
  f->readable = !(omode & O_WRONLY);
801060e9:	8b 45 e4             	mov    -0x1c(%ebp),%eax
801060ec:	83 e0 01             	and    $0x1,%eax
801060ef:	85 c0                	test   %eax,%eax
801060f1:	0f 94 c0             	sete   %al
801060f4:	89 c2                	mov    %eax,%edx
801060f6:	8b 45 f0             	mov    -0x10(%ebp),%eax
801060f9:	88 50 08             	mov    %dl,0x8(%eax)
  f->writable = (omode & O_WRONLY) || (omode & O_RDWR);
801060fc:	8b 45 e4             	mov    -0x1c(%ebp),%eax
801060ff:	83 e0 01             	and    $0x1,%eax
80106102:	85 c0                	test   %eax,%eax
80106104:	75 0a                	jne    80106110 <sys_open+0x16f>
80106106:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80106109:	83 e0 02             	and    $0x2,%eax
8010610c:	85 c0                	test   %eax,%eax
8010610e:	74 07                	je     80106117 <sys_open+0x176>
80106110:	b8 01 00 00 00       	mov    $0x1,%eax
80106115:	eb 05                	jmp    8010611c <sys_open+0x17b>
80106117:	b8 00 00 00 00       	mov    $0x0,%eax
8010611c:	89 c2                	mov    %eax,%edx
8010611e:	8b 45 f0             	mov    -0x10(%ebp),%eax
80106121:	88 50 09             	mov    %dl,0x9(%eax)
  return fd;
80106124:	8b 45 ec             	mov    -0x14(%ebp),%eax
}
80106127:	c9                   	leave  
80106128:	c3                   	ret    

80106129 <sys_mkdir>:

int
sys_mkdir(void)
{
80106129:	55                   	push   %ebp
8010612a:	89 e5                	mov    %esp,%ebp
8010612c:	83 ec 28             	sub    $0x28,%esp
  char *path;
  struct inode *ip;

  begin_trans();
8010612f:	e8 3c d1 ff ff       	call   80103270 <begin_trans>
  if(argstr(0, &path) < 0 || (ip = create(path, T_DIR, 0, 0)) == 0){
80106134:	8d 45 f0             	lea    -0x10(%ebp),%eax
80106137:	89 44 24 04          	mov    %eax,0x4(%esp)
8010613b:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
80106142:	e8 15 f5 ff ff       	call   8010565c <argstr>
80106147:	85 c0                	test   %eax,%eax
80106149:	78 2c                	js     80106177 <sys_mkdir+0x4e>
8010614b:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010614e:	c7 44 24 0c 00 00 00 	movl   $0x0,0xc(%esp)
80106155:	00 
80106156:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
8010615d:	00 
8010615e:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
80106165:	00 
80106166:	89 04 24             	mov    %eax,(%esp)
80106169:	e8 73 fc ff ff       	call   80105de1 <create>
8010616e:	89 45 f4             	mov    %eax,-0xc(%ebp)
80106171:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80106175:	75 0c                	jne    80106183 <sys_mkdir+0x5a>
    commit_trans();
80106177:	e8 3d d1 ff ff       	call   801032b9 <commit_trans>
    return -1;
8010617c:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80106181:	eb 15                	jmp    80106198 <sys_mkdir+0x6f>
  }
  iunlockput(ip);
80106183:	8b 45 f4             	mov    -0xc(%ebp),%eax
80106186:	89 04 24             	mov    %eax,(%esp)
80106189:	e8 8a b9 ff ff       	call   80101b18 <iunlockput>
  commit_trans();
8010618e:	e8 26 d1 ff ff       	call   801032b9 <commit_trans>
  return 0;
80106193:	b8 00 00 00 00       	mov    $0x0,%eax
}
80106198:	c9                   	leave  
80106199:	c3                   	ret    

8010619a <sys_mknod>:

int
sys_mknod(void)
{
8010619a:	55                   	push   %ebp
8010619b:	89 e5                	mov    %esp,%ebp
8010619d:	83 ec 38             	sub    $0x38,%esp
  struct inode *ip;
  char *path;
  int len;
  int major, minor;
  
  begin_trans();
801061a0:	e8 cb d0 ff ff       	call   80103270 <begin_trans>
  if((len=argstr(0, &path)) < 0 ||
801061a5:	8d 45 ec             	lea    -0x14(%ebp),%eax
801061a8:	89 44 24 04          	mov    %eax,0x4(%esp)
801061ac:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
801061b3:	e8 a4 f4 ff ff       	call   8010565c <argstr>
801061b8:	89 45 f4             	mov    %eax,-0xc(%ebp)
801061bb:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
801061bf:	78 5e                	js     8010621f <sys_mknod+0x85>
     argint(1, &major) < 0 ||
801061c1:	8d 45 e8             	lea    -0x18(%ebp),%eax
801061c4:	89 44 24 04          	mov    %eax,0x4(%esp)
801061c8:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
801061cf:	e8 ee f3 ff ff       	call   801055c2 <argint>
  char *path;
  int len;
  int major, minor;
  
  begin_trans();
  if((len=argstr(0, &path)) < 0 ||
801061d4:	85 c0                	test   %eax,%eax
801061d6:	78 47                	js     8010621f <sys_mknod+0x85>
     argint(1, &major) < 0 ||
     argint(2, &minor) < 0 ||
801061d8:	8d 45 e4             	lea    -0x1c(%ebp),%eax
801061db:	89 44 24 04          	mov    %eax,0x4(%esp)
801061df:	c7 04 24 02 00 00 00 	movl   $0x2,(%esp)
801061e6:	e8 d7 f3 ff ff       	call   801055c2 <argint>
  int len;
  int major, minor;
  
  begin_trans();
  if((len=argstr(0, &path)) < 0 ||
     argint(1, &major) < 0 ||
801061eb:	85 c0                	test   %eax,%eax
801061ed:	78 30                	js     8010621f <sys_mknod+0x85>
     argint(2, &minor) < 0 ||
     (ip = create(path, T_DEV, major, minor)) == 0){
801061ef:	8b 45 e4             	mov    -0x1c(%ebp),%eax
801061f2:	0f bf c8             	movswl %ax,%ecx
801061f5:	8b 45 e8             	mov    -0x18(%ebp),%eax
801061f8:	0f bf d0             	movswl %ax,%edx
801061fb:	8b 45 ec             	mov    -0x14(%ebp),%eax
  int major, minor;
  
  begin_trans();
  if((len=argstr(0, &path)) < 0 ||
     argint(1, &major) < 0 ||
     argint(2, &minor) < 0 ||
801061fe:	89 4c 24 0c          	mov    %ecx,0xc(%esp)
80106202:	89 54 24 08          	mov    %edx,0x8(%esp)
80106206:	c7 44 24 04 03 00 00 	movl   $0x3,0x4(%esp)
8010620d:	00 
8010620e:	89 04 24             	mov    %eax,(%esp)
80106211:	e8 cb fb ff ff       	call   80105de1 <create>
80106216:	89 45 f0             	mov    %eax,-0x10(%ebp)
80106219:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
8010621d:	75 0c                	jne    8010622b <sys_mknod+0x91>
     (ip = create(path, T_DEV, major, minor)) == 0){
    commit_trans();
8010621f:	e8 95 d0 ff ff       	call   801032b9 <commit_trans>
    return -1;
80106224:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80106229:	eb 15                	jmp    80106240 <sys_mknod+0xa6>
  }
  iunlockput(ip);
8010622b:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010622e:	89 04 24             	mov    %eax,(%esp)
80106231:	e8 e2 b8 ff ff       	call   80101b18 <iunlockput>
  commit_trans();
80106236:	e8 7e d0 ff ff       	call   801032b9 <commit_trans>
  return 0;
8010623b:	b8 00 00 00 00       	mov    $0x0,%eax
}
80106240:	c9                   	leave  
80106241:	c3                   	ret    

80106242 <sys_chdir>:

int
sys_chdir(void)
{
80106242:	55                   	push   %ebp
80106243:	89 e5                	mov    %esp,%ebp
80106245:	83 ec 28             	sub    $0x28,%esp
  char *path;
  struct inode *ip;

  if(argstr(0, &path) < 0 || (ip = namei(path)) == 0)
80106248:	8d 45 f0             	lea    -0x10(%ebp),%eax
8010624b:	89 44 24 04          	mov    %eax,0x4(%esp)
8010624f:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
80106256:	e8 01 f4 ff ff       	call   8010565c <argstr>
8010625b:	85 c0                	test   %eax,%eax
8010625d:	78 14                	js     80106273 <sys_chdir+0x31>
8010625f:	8b 45 f0             	mov    -0x10(%ebp),%eax
80106262:	89 04 24             	mov    %eax,(%esp)
80106265:	e8 eb c1 ff ff       	call   80102455 <namei>
8010626a:	89 45 f4             	mov    %eax,-0xc(%ebp)
8010626d:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80106271:	75 07                	jne    8010627a <sys_chdir+0x38>
    return -1;
80106273:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80106278:	eb 57                	jmp    801062d1 <sys_chdir+0x8f>
  ilock(ip);
8010627a:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010627d:	89 04 24             	mov    %eax,(%esp)
80106280:	e8 0f b6 ff ff       	call   80101894 <ilock>
  if(ip->type != T_DIR){
80106285:	8b 45 f4             	mov    -0xc(%ebp),%eax
80106288:	0f b7 40 10          	movzwl 0x10(%eax),%eax
8010628c:	66 83 f8 01          	cmp    $0x1,%ax
80106290:	74 12                	je     801062a4 <sys_chdir+0x62>
    iunlockput(ip);
80106292:	8b 45 f4             	mov    -0xc(%ebp),%eax
80106295:	89 04 24             	mov    %eax,(%esp)
80106298:	e8 7b b8 ff ff       	call   80101b18 <iunlockput>
    return -1;
8010629d:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
801062a2:	eb 2d                	jmp    801062d1 <sys_chdir+0x8f>
  }
  iunlock(ip);
801062a4:	8b 45 f4             	mov    -0xc(%ebp),%eax
801062a7:	89 04 24             	mov    %eax,(%esp)
801062aa:	e8 33 b7 ff ff       	call   801019e2 <iunlock>
  iput(proc->cwd);
801062af:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801062b5:	8b 40 68             	mov    0x68(%eax),%eax
801062b8:	89 04 24             	mov    %eax,(%esp)
801062bb:	e8 87 b7 ff ff       	call   80101a47 <iput>
  proc->cwd = ip;
801062c0:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801062c6:	8b 55 f4             	mov    -0xc(%ebp),%edx
801062c9:	89 50 68             	mov    %edx,0x68(%eax)
  return 0;
801062cc:	b8 00 00 00 00       	mov    $0x0,%eax
}
801062d1:	c9                   	leave  
801062d2:	c3                   	ret    

801062d3 <sys_exec>:

int
sys_exec(void)
{
801062d3:	55                   	push   %ebp
801062d4:	89 e5                	mov    %esp,%ebp
801062d6:	81 ec a8 00 00 00    	sub    $0xa8,%esp
  char *path, *argv[MAXARG];
  int i;
  uint uargv, uarg;

  if(argstr(0, &path) < 0 || argint(1, (int*)&uargv) < 0){
801062dc:	8d 45 f0             	lea    -0x10(%ebp),%eax
801062df:	89 44 24 04          	mov    %eax,0x4(%esp)
801062e3:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
801062ea:	e8 6d f3 ff ff       	call   8010565c <argstr>
801062ef:	85 c0                	test   %eax,%eax
801062f1:	78 1a                	js     8010630d <sys_exec+0x3a>
801062f3:	8d 85 6c ff ff ff    	lea    -0x94(%ebp),%eax
801062f9:	89 44 24 04          	mov    %eax,0x4(%esp)
801062fd:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
80106304:	e8 b9 f2 ff ff       	call   801055c2 <argint>
80106309:	85 c0                	test   %eax,%eax
8010630b:	79 0a                	jns    80106317 <sys_exec+0x44>
    return -1;
8010630d:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80106312:	e9 de 00 00 00       	jmp    801063f5 <sys_exec+0x122>
  }
  memset(argv, 0, sizeof(argv));
80106317:	c7 44 24 08 80 00 00 	movl   $0x80,0x8(%esp)
8010631e:	00 
8010631f:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
80106326:	00 
80106327:	8d 85 70 ff ff ff    	lea    -0x90(%ebp),%eax
8010632d:	89 04 24             	mov    %eax,(%esp)
80106330:	e8 3d ef ff ff       	call   80105272 <memset>
  for(i=0;; i++){
80106335:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
    if(i >= NELEM(argv))
8010633c:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010633f:	83 f8 1f             	cmp    $0x1f,%eax
80106342:	76 0a                	jbe    8010634e <sys_exec+0x7b>
      return -1;
80106344:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80106349:	e9 a7 00 00 00       	jmp    801063f5 <sys_exec+0x122>
    if(fetchint(proc, uargv+4*i, (int*)&uarg) < 0)
8010634e:	8b 45 f4             	mov    -0xc(%ebp),%eax
80106351:	c1 e0 02             	shl    $0x2,%eax
80106354:	89 c2                	mov    %eax,%edx
80106356:	8b 85 6c ff ff ff    	mov    -0x94(%ebp),%eax
8010635c:	8d 0c 02             	lea    (%edx,%eax,1),%ecx
8010635f:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80106365:	8d 95 68 ff ff ff    	lea    -0x98(%ebp),%edx
8010636b:	89 54 24 08          	mov    %edx,0x8(%esp)
8010636f:	89 4c 24 04          	mov    %ecx,0x4(%esp)
80106373:	89 04 24             	mov    %eax,(%esp)
80106376:	e8 b5 f1 ff ff       	call   80105530 <fetchint>
8010637b:	85 c0                	test   %eax,%eax
8010637d:	79 07                	jns    80106386 <sys_exec+0xb3>
      return -1;
8010637f:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80106384:	eb 6f                	jmp    801063f5 <sys_exec+0x122>
    if(uarg == 0){
80106386:	8b 85 68 ff ff ff    	mov    -0x98(%ebp),%eax
8010638c:	85 c0                	test   %eax,%eax
8010638e:	75 26                	jne    801063b6 <sys_exec+0xe3>
      argv[i] = 0;
80106390:	8b 45 f4             	mov    -0xc(%ebp),%eax
80106393:	c7 84 85 70 ff ff ff 	movl   $0x0,-0x90(%ebp,%eax,4)
8010639a:	00 00 00 00 
      break;
8010639e:	90                   	nop
    }
    if(fetchstr(proc, uarg, &argv[i]) < 0)
      return -1;
  }
  return exec(path, argv);
8010639f:	8b 45 f0             	mov    -0x10(%ebp),%eax
801063a2:	8d 95 70 ff ff ff    	lea    -0x90(%ebp),%edx
801063a8:	89 54 24 04          	mov    %edx,0x4(%esp)
801063ac:	89 04 24             	mov    %eax,(%esp)
801063af:	e8 54 a7 ff ff       	call   80100b08 <exec>
801063b4:	eb 3f                	jmp    801063f5 <sys_exec+0x122>
      return -1;
    if(uarg == 0){
      argv[i] = 0;
      break;
    }
    if(fetchstr(proc, uarg, &argv[i]) < 0)
801063b6:	8d 85 70 ff ff ff    	lea    -0x90(%ebp),%eax
801063bc:	8b 55 f4             	mov    -0xc(%ebp),%edx
801063bf:	c1 e2 02             	shl    $0x2,%edx
801063c2:	8d 0c 10             	lea    (%eax,%edx,1),%ecx
801063c5:	8b 95 68 ff ff ff    	mov    -0x98(%ebp),%edx
801063cb:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801063d1:	89 4c 24 08          	mov    %ecx,0x8(%esp)
801063d5:	89 54 24 04          	mov    %edx,0x4(%esp)
801063d9:	89 04 24             	mov    %eax,(%esp)
801063dc:	e8 83 f1 ff ff       	call   80105564 <fetchstr>
801063e1:	85 c0                	test   %eax,%eax
801063e3:	79 07                	jns    801063ec <sys_exec+0x119>
      return -1;
801063e5:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
801063ea:	eb 09                	jmp    801063f5 <sys_exec+0x122>

  if(argstr(0, &path) < 0 || argint(1, (int*)&uargv) < 0){
    return -1;
  }
  memset(argv, 0, sizeof(argv));
  for(i=0;; i++){
801063ec:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
      argv[i] = 0;
      break;
    }
    if(fetchstr(proc, uarg, &argv[i]) < 0)
      return -1;
  }
801063f0:	e9 47 ff ff ff       	jmp    8010633c <sys_exec+0x69>
  return exec(path, argv);
}
801063f5:	c9                   	leave  
801063f6:	c3                   	ret    

801063f7 <sys_pipe>:

int
sys_pipe(void)
{
801063f7:	55                   	push   %ebp
801063f8:	89 e5                	mov    %esp,%ebp
801063fa:	83 ec 38             	sub    $0x38,%esp
  int *fd;
  struct file *rf, *wf;
  int fd0, fd1;

  if(argptr(0, (void*)&fd, 2*sizeof(fd[0])) < 0)
801063fd:	c7 44 24 08 08 00 00 	movl   $0x8,0x8(%esp)
80106404:	00 
80106405:	8d 45 ec             	lea    -0x14(%ebp),%eax
80106408:	89 44 24 04          	mov    %eax,0x4(%esp)
8010640c:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
80106413:	e8 e2 f1 ff ff       	call   801055fa <argptr>
80106418:	85 c0                	test   %eax,%eax
8010641a:	79 0a                	jns    80106426 <sys_pipe+0x2f>
    return -1;
8010641c:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80106421:	e9 9b 00 00 00       	jmp    801064c1 <sys_pipe+0xca>
  if(pipealloc(&rf, &wf) < 0)
80106426:	8d 45 e4             	lea    -0x1c(%ebp),%eax
80106429:	89 44 24 04          	mov    %eax,0x4(%esp)
8010642d:	8d 45 e8             	lea    -0x18(%ebp),%eax
80106430:	89 04 24             	mov    %eax,(%esp)
80106433:	e8 5c d8 ff ff       	call   80103c94 <pipealloc>
80106438:	85 c0                	test   %eax,%eax
8010643a:	79 07                	jns    80106443 <sys_pipe+0x4c>
    return -1;
8010643c:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80106441:	eb 7e                	jmp    801064c1 <sys_pipe+0xca>
  fd0 = -1;
80106443:	c7 45 f4 ff ff ff ff 	movl   $0xffffffff,-0xc(%ebp)
  if((fd0 = fdalloc(rf)) < 0 || (fd1 = fdalloc(wf)) < 0){
8010644a:	8b 45 e8             	mov    -0x18(%ebp),%eax
8010644d:	89 04 24             	mov    %eax,(%esp)
80106450:	e8 84 f3 ff ff       	call   801057d9 <fdalloc>
80106455:	89 45 f4             	mov    %eax,-0xc(%ebp)
80106458:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
8010645c:	78 14                	js     80106472 <sys_pipe+0x7b>
8010645e:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80106461:	89 04 24             	mov    %eax,(%esp)
80106464:	e8 70 f3 ff ff       	call   801057d9 <fdalloc>
80106469:	89 45 f0             	mov    %eax,-0x10(%ebp)
8010646c:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
80106470:	79 37                	jns    801064a9 <sys_pipe+0xb2>
    if(fd0 >= 0)
80106472:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80106476:	78 14                	js     8010648c <sys_pipe+0x95>
      proc->ofile[fd0] = 0;
80106478:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
8010647e:	8b 55 f4             	mov    -0xc(%ebp),%edx
80106481:	83 c2 08             	add    $0x8,%edx
80106484:	c7 44 90 08 00 00 00 	movl   $0x0,0x8(%eax,%edx,4)
8010648b:	00 
    fileclose(rf);
8010648c:	8b 45 e8             	mov    -0x18(%ebp),%eax
8010648f:	89 04 24             	mov    %eax,(%esp)
80106492:	e8 55 ab ff ff       	call   80100fec <fileclose>
    fileclose(wf);
80106497:	8b 45 e4             	mov    -0x1c(%ebp),%eax
8010649a:	89 04 24             	mov    %eax,(%esp)
8010649d:	e8 4a ab ff ff       	call   80100fec <fileclose>
    return -1;
801064a2:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
801064a7:	eb 18                	jmp    801064c1 <sys_pipe+0xca>
  }
  fd[0] = fd0;
801064a9:	8b 45 ec             	mov    -0x14(%ebp),%eax
801064ac:	8b 55 f4             	mov    -0xc(%ebp),%edx
801064af:	89 10                	mov    %edx,(%eax)
  fd[1] = fd1;
801064b1:	8b 45 ec             	mov    -0x14(%ebp),%eax
801064b4:	8d 50 04             	lea    0x4(%eax),%edx
801064b7:	8b 45 f0             	mov    -0x10(%ebp),%eax
801064ba:	89 02                	mov    %eax,(%edx)
  return 0;
801064bc:	b8 00 00 00 00       	mov    $0x0,%eax
}
801064c1:	c9                   	leave  
801064c2:	c3                   	ret    
801064c3:	90                   	nop

801064c4 <sys_fork>:
#include "mmu.h"
#include "proc.h"

int
sys_fork(void)
{
801064c4:	55                   	push   %ebp
801064c5:	89 e5                	mov    %esp,%ebp
801064c7:	83 ec 08             	sub    $0x8,%esp
  return fork();
801064ca:	e8 c3 de ff ff       	call   80104392 <fork>
}
801064cf:	c9                   	leave  
801064d0:	c3                   	ret    

801064d1 <sys_exit>:

int
sys_exit(void)
{
801064d1:	55                   	push   %ebp
801064d2:	89 e5                	mov    %esp,%ebp
801064d4:	83 ec 08             	sub    $0x8,%esp
  exit();
801064d7:	e8 56 e0 ff ff       	call   80104532 <exit>
  return 0;  // not reached
801064dc:	b8 00 00 00 00       	mov    $0x0,%eax
}
801064e1:	c9                   	leave  
801064e2:	c3                   	ret    

801064e3 <sys_wait>:

int
sys_wait(void)
{
801064e3:	55                   	push   %ebp
801064e4:	89 e5                	mov    %esp,%ebp
801064e6:	83 ec 08             	sub    $0x8,%esp
  return wait();
801064e9:	e8 5f e1 ff ff       	call   8010464d <wait>
}
801064ee:	c9                   	leave  
801064ef:	c3                   	ret    

801064f0 <sys_kill>:

int
sys_kill(void)
{
801064f0:	55                   	push   %ebp
801064f1:	89 e5                	mov    %esp,%ebp
801064f3:	83 ec 28             	sub    $0x28,%esp
  int pid;

  if(argint(0, &pid) < 0)
801064f6:	8d 45 f4             	lea    -0xc(%ebp),%eax
801064f9:	89 44 24 04          	mov    %eax,0x4(%esp)
801064fd:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
80106504:	e8 b9 f0 ff ff       	call   801055c2 <argint>
80106509:	85 c0                	test   %eax,%eax
8010650b:	79 07                	jns    80106514 <sys_kill+0x24>
    return -1;
8010650d:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80106512:	eb 0b                	jmp    8010651f <sys_kill+0x2f>
  return kill(pid);
80106514:	8b 45 f4             	mov    -0xc(%ebp),%eax
80106517:	89 04 24             	mov    %eax,(%esp)
8010651a:	e8 2a e6 ff ff       	call   80104b49 <kill>
}
8010651f:	c9                   	leave  
80106520:	c3                   	ret    

80106521 <sys_getpid>:

int
sys_getpid(void)
{
80106521:	55                   	push   %ebp
80106522:	89 e5                	mov    %esp,%ebp
  return proc->pid;
80106524:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
8010652a:	8b 40 10             	mov    0x10(%eax),%eax
}
8010652d:	5d                   	pop    %ebp
8010652e:	c3                   	ret    

8010652f <sys_sbrk>:

int
sys_sbrk(void)
{
8010652f:	55                   	push   %ebp
80106530:	89 e5                	mov    %esp,%ebp
80106532:	83 ec 28             	sub    $0x28,%esp
  int addr;
  int n;

  if(argint(0, &n) < 0)
80106535:	8d 45 f0             	lea    -0x10(%ebp),%eax
80106538:	89 44 24 04          	mov    %eax,0x4(%esp)
8010653c:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
80106543:	e8 7a f0 ff ff       	call   801055c2 <argint>
80106548:	85 c0                	test   %eax,%eax
8010654a:	79 07                	jns    80106553 <sys_sbrk+0x24>
    return -1;
8010654c:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80106551:	eb 24                	jmp    80106577 <sys_sbrk+0x48>
  addr = proc->sz;
80106553:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80106559:	8b 00                	mov    (%eax),%eax
8010655b:	89 45 f4             	mov    %eax,-0xc(%ebp)
  if(growproc(n) < 0)
8010655e:	8b 45 f0             	mov    -0x10(%ebp),%eax
80106561:	89 04 24             	mov    %eax,(%esp)
80106564:	e8 84 dd ff ff       	call   801042ed <growproc>
80106569:	85 c0                	test   %eax,%eax
8010656b:	79 07                	jns    80106574 <sys_sbrk+0x45>
    return -1;
8010656d:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80106572:	eb 03                	jmp    80106577 <sys_sbrk+0x48>
  return addr;
80106574:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
80106577:	c9                   	leave  
80106578:	c3                   	ret    

80106579 <sys_sleep>:

int
sys_sleep(void)
{
80106579:	55                   	push   %ebp
8010657a:	89 e5                	mov    %esp,%ebp
8010657c:	83 ec 28             	sub    $0x28,%esp
  int n;
  uint ticks0;
  
  if(argint(0, &n) < 0)
8010657f:	8d 45 f0             	lea    -0x10(%ebp),%eax
80106582:	89 44 24 04          	mov    %eax,0x4(%esp)
80106586:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
8010658d:	e8 30 f0 ff ff       	call   801055c2 <argint>
80106592:	85 c0                	test   %eax,%eax
80106594:	79 07                	jns    8010659d <sys_sleep+0x24>
    return -1;
80106596:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
8010659b:	eb 6c                	jmp    80106609 <sys_sleep+0x90>
  acquire(&tickslock);
8010659d:	c7 04 24 a0 40 11 80 	movl   $0x801140a0,(%esp)
801065a4:	e8 6e ea ff ff       	call   80105017 <acquire>
  ticks0 = ticks;
801065a9:	a1 e0 48 11 80       	mov    0x801148e0,%eax
801065ae:	89 45 f4             	mov    %eax,-0xc(%ebp)
  while(ticks - ticks0 < n){
801065b1:	eb 34                	jmp    801065e7 <sys_sleep+0x6e>
    if(proc->killed){
801065b3:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801065b9:	8b 40 24             	mov    0x24(%eax),%eax
801065bc:	85 c0                	test   %eax,%eax
801065be:	74 13                	je     801065d3 <sys_sleep+0x5a>
      release(&tickslock);
801065c0:	c7 04 24 a0 40 11 80 	movl   $0x801140a0,(%esp)
801065c7:	e8 ad ea ff ff       	call   80105079 <release>
      return -1;
801065cc:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
801065d1:	eb 36                	jmp    80106609 <sys_sleep+0x90>
    }
    sleep(&ticks, &tickslock);
801065d3:	c7 44 24 04 a0 40 11 	movl   $0x801140a0,0x4(%esp)
801065da:	80 
801065db:	c7 04 24 e0 48 11 80 	movl   $0x801148e0,(%esp)
801065e2:	e8 5b e4 ff ff       	call   80104a42 <sleep>
  
  if(argint(0, &n) < 0)
    return -1;
  acquire(&tickslock);
  ticks0 = ticks;
  while(ticks - ticks0 < n){
801065e7:	a1 e0 48 11 80       	mov    0x801148e0,%eax
801065ec:	89 c2                	mov    %eax,%edx
801065ee:	2b 55 f4             	sub    -0xc(%ebp),%edx
801065f1:	8b 45 f0             	mov    -0x10(%ebp),%eax
801065f4:	39 c2                	cmp    %eax,%edx
801065f6:	72 bb                	jb     801065b3 <sys_sleep+0x3a>
      release(&tickslock);
      return -1;
    }
    sleep(&ticks, &tickslock);
  }
  release(&tickslock);
801065f8:	c7 04 24 a0 40 11 80 	movl   $0x801140a0,(%esp)
801065ff:	e8 75 ea ff ff       	call   80105079 <release>
  return 0;
80106604:	b8 00 00 00 00       	mov    $0x0,%eax
}
80106609:	c9                   	leave  
8010660a:	c3                   	ret    

8010660b <sys_uptime>:

// return how many clock tick interrupts have occurred
// since start.
int
sys_uptime(void)
{
8010660b:	55                   	push   %ebp
8010660c:	89 e5                	mov    %esp,%ebp
8010660e:	83 ec 28             	sub    $0x28,%esp
  uint xticks;
  
  acquire(&tickslock);
80106611:	c7 04 24 a0 40 11 80 	movl   $0x801140a0,(%esp)
80106618:	e8 fa e9 ff ff       	call   80105017 <acquire>
  xticks = ticks;
8010661d:	a1 e0 48 11 80       	mov    0x801148e0,%eax
80106622:	89 45 f4             	mov    %eax,-0xc(%ebp)
  release(&tickslock);
80106625:	c7 04 24 a0 40 11 80 	movl   $0x801140a0,(%esp)
8010662c:	e8 48 ea ff ff       	call   80105079 <release>
  return xticks;
80106631:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
80106634:	c9                   	leave  
80106635:	c3                   	ret    

80106636 <sys_signal>:


/** OUR ADDITION - 1.2 **/
int
sys_signal(void)
{
80106636:	55                   	push   %ebp
80106637:	89 e5                	mov    %esp,%ebp
80106639:	83 ec 28             	sub    $0x28,%esp
	int signum;
	sighandler_t handler;
	argint(0, &signum);
8010663c:	8d 45 f4             	lea    -0xc(%ebp),%eax
8010663f:	89 44 24 04          	mov    %eax,0x4(%esp)
80106643:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
8010664a:	e8 73 ef ff ff       	call   801055c2 <argint>
	argptr(1, (void*)&handler, sizeof(handler));
8010664f:	c7 44 24 08 04 00 00 	movl   $0x4,0x8(%esp)
80106656:	00 
80106657:	8d 45 f0             	lea    -0x10(%ebp),%eax
8010665a:	89 44 24 04          	mov    %eax,0x4(%esp)
8010665e:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
80106665:	e8 90 ef ff ff       	call   801055fa <argptr>
	return signal(signum, handler);
8010666a:	8b 55 f0             	mov    -0x10(%ebp),%edx
8010666d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80106670:	89 54 24 04          	mov    %edx,0x4(%esp)
80106674:	89 04 24             	mov    %eax,(%esp)
80106677:	e8 65 e6 ff ff       	call   80104ce1 <signal>
}
8010667c:	c9                   	leave  
8010667d:	c3                   	ret    

8010667e <sys_sigsend>:

/** OUR ADDITION - 1.3 **/
int
sys_sigsend(void)
{
8010667e:	55                   	push   %ebp
8010667f:	89 e5                	mov    %esp,%ebp
80106681:	83 ec 28             	sub    $0x28,%esp
	int pid, signum;
	argint(0, &pid);
80106684:	8d 45 f4             	lea    -0xc(%ebp),%eax
80106687:	89 44 24 04          	mov    %eax,0x4(%esp)
8010668b:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
80106692:	e8 2b ef ff ff       	call   801055c2 <argint>
	argint(1, &signum);
80106697:	8d 45 f0             	lea    -0x10(%ebp),%eax
8010669a:	89 44 24 04          	mov    %eax,0x4(%esp)
8010669e:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
801066a5:	e8 18 ef ff ff       	call   801055c2 <argint>
	return sigsend(pid,signum);
801066aa:	8b 55 f0             	mov    -0x10(%ebp),%edx
801066ad:	8b 45 f4             	mov    -0xc(%ebp),%eax
801066b0:	89 54 24 04          	mov    %edx,0x4(%esp)
801066b4:	89 04 24             	mov    %eax,(%esp)
801066b7:	e8 a7 e6 ff ff       	call   80104d63 <sigsend>
}
801066bc:	c9                   	leave  
801066bd:	c3                   	ret    

801066be <sys_alarm>:

/** OUR ADDITION - 1.6 **/
void
sys_alarm(void)
{
801066be:	55                   	push   %ebp
801066bf:	89 e5                	mov    %esp,%ebp
801066c1:	83 ec 28             	sub    $0x28,%esp
	int ticks;
	if(argint(0, &ticks) > -1 )
801066c4:	8d 45 f4             	lea    -0xc(%ebp),%eax
801066c7:	89 44 24 04          	mov    %eax,0x4(%esp)
801066cb:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
801066d2:	e8 eb ee ff ff       	call   801055c2 <argint>
801066d7:	85 c0                	test   %eax,%eax
801066d9:	78 0b                	js     801066e6 <sys_alarm+0x28>
		alarm(ticks);
801066db:	8b 45 f4             	mov    -0xc(%ebp),%eax
801066de:	89 04 24             	mov    %eax,(%esp)
801066e1:	e8 9d e7 ff ff       	call   80104e83 <alarm>
}
801066e6:	c9                   	leave  
801066e7:	c3                   	ret    

801066e8 <sys_getTicks>:

int
sys_getTicks(void)
{
801066e8:	55                   	push   %ebp
801066e9:	89 e5                	mov    %esp,%ebp
801066eb:	83 ec 08             	sub    $0x8,%esp
	return getTicks();
801066ee:	e8 ab e8 ff ff       	call   80104f9e <getTicks>
}
801066f3:	c9                   	leave  
801066f4:	c3                   	ret    
801066f5:	66 90                	xchg   %ax,%ax
801066f7:	90                   	nop

801066f8 <outb>:
               "memory", "cc");
}

static inline void
outb(ushort port, uchar data)
{
801066f8:	55                   	push   %ebp
801066f9:	89 e5                	mov    %esp,%ebp
801066fb:	83 ec 08             	sub    $0x8,%esp
801066fe:	8b 55 08             	mov    0x8(%ebp),%edx
80106701:	8b 45 0c             	mov    0xc(%ebp),%eax
80106704:	66 89 55 fc          	mov    %dx,-0x4(%ebp)
80106708:	88 45 f8             	mov    %al,-0x8(%ebp)
  asm volatile("out %0,%1" : : "a" (data), "d" (port));
8010670b:	0f b6 45 f8          	movzbl -0x8(%ebp),%eax
8010670f:	0f b7 55 fc          	movzwl -0x4(%ebp),%edx
80106713:	ee                   	out    %al,(%dx)
}
80106714:	c9                   	leave  
80106715:	c3                   	ret    

80106716 <timerinit>:
#define TIMER_RATEGEN   0x04    // mode 2, rate generator
#define TIMER_16BIT     0x30    // r/w counter 16 bits, LSB first

void
timerinit(void)
{
80106716:	55                   	push   %ebp
80106717:	89 e5                	mov    %esp,%ebp
80106719:	83 ec 18             	sub    $0x18,%esp
  // Interrupt 100 times/sec.
  outb(TIMER_MODE, TIMER_SEL0 | TIMER_RATEGEN | TIMER_16BIT);
8010671c:	c7 44 24 04 34 00 00 	movl   $0x34,0x4(%esp)
80106723:	00 
80106724:	c7 04 24 43 00 00 00 	movl   $0x43,(%esp)
8010672b:	e8 c8 ff ff ff       	call   801066f8 <outb>
  outb(IO_TIMER1, TIMER_DIV(100) % 256);
80106730:	c7 44 24 04 9c 00 00 	movl   $0x9c,0x4(%esp)
80106737:	00 
80106738:	c7 04 24 40 00 00 00 	movl   $0x40,(%esp)
8010673f:	e8 b4 ff ff ff       	call   801066f8 <outb>
  outb(IO_TIMER1, TIMER_DIV(100) / 256);
80106744:	c7 44 24 04 2e 00 00 	movl   $0x2e,0x4(%esp)
8010674b:	00 
8010674c:	c7 04 24 40 00 00 00 	movl   $0x40,(%esp)
80106753:	e8 a0 ff ff ff       	call   801066f8 <outb>
  picenable(IRQ_TIMER);
80106758:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
8010675f:	e8 b9 d3 ff ff       	call   80103b1d <picenable>
}
80106764:	c9                   	leave  
80106765:	c3                   	ret    
80106766:	66 90                	xchg   %ax,%ax

80106768 <alltraps>:

  # vectors.S sends all traps here.
.globl alltraps
alltraps:
  # Build trap frame.
  pushl %ds
80106768:	1e                   	push   %ds
  pushl %es
80106769:	06                   	push   %es
  pushl %fs
8010676a:	0f a0                	push   %fs
  pushl %gs
8010676c:	0f a8                	push   %gs
  pushal
8010676e:	60                   	pusha  
  
  # Set up data and per-cpu segments.
  movw $(SEG_KDATA<<3), %ax
8010676f:	66 b8 10 00          	mov    $0x10,%ax
  movw %ax, %ds
80106773:	8e d8                	mov    %eax,%ds
  movw %ax, %es
80106775:	8e c0                	mov    %eax,%es
  movw $(SEG_KCPU<<3), %ax
80106777:	66 b8 18 00          	mov    $0x18,%ax
  movw %ax, %fs
8010677b:	8e e0                	mov    %eax,%fs
  movw %ax, %gs
8010677d:	8e e8                	mov    %eax,%gs

  # Call trap(tf), where tf=%esp
  pushl %esp
8010677f:	54                   	push   %esp
  call trap
80106780:	e8 de 01 00 00       	call   80106963 <trap>
  addl $4, %esp
80106785:	83 c4 04             	add    $0x4,%esp

80106788 <trapret>:

  # Return falls through to trapret...
.globl trapret
trapret:
  popal
80106788:	61                   	popa   
  popl %gs
80106789:	0f a9                	pop    %gs
  popl %fs
8010678b:	0f a1                	pop    %fs
  popl %es
8010678d:	07                   	pop    %es
  popl %ds
8010678e:	1f                   	pop    %ds
  addl $0x8, %esp  # trapno and errcode
8010678f:	83 c4 08             	add    $0x8,%esp
  iret
80106792:	cf                   	iret   
80106793:	90                   	nop

80106794 <lidt>:

struct gatedesc;

static inline void
lidt(struct gatedesc *p, int size)
{
80106794:	55                   	push   %ebp
80106795:	89 e5                	mov    %esp,%ebp
80106797:	83 ec 10             	sub    $0x10,%esp
  volatile ushort pd[3];

  pd[0] = size-1;
8010679a:	8b 45 0c             	mov    0xc(%ebp),%eax
8010679d:	83 e8 01             	sub    $0x1,%eax
801067a0:	66 89 45 fa          	mov    %ax,-0x6(%ebp)
  pd[1] = (uint)p;
801067a4:	8b 45 08             	mov    0x8(%ebp),%eax
801067a7:	66 89 45 fc          	mov    %ax,-0x4(%ebp)
  pd[2] = (uint)p >> 16;
801067ab:	8b 45 08             	mov    0x8(%ebp),%eax
801067ae:	c1 e8 10             	shr    $0x10,%eax
801067b1:	66 89 45 fe          	mov    %ax,-0x2(%ebp)

  asm volatile("lidt (%0)" : : "r" (pd));
801067b5:	8d 45 fa             	lea    -0x6(%ebp),%eax
801067b8:	0f 01 18             	lidtl  (%eax)
}
801067bb:	c9                   	leave  
801067bc:	c3                   	ret    

801067bd <rcr2>:
  return result;
}

static inline uint
rcr2(void)
{
801067bd:	55                   	push   %ebp
801067be:	89 e5                	mov    %esp,%ebp
801067c0:	53                   	push   %ebx
801067c1:	83 ec 10             	sub    $0x10,%esp
  uint val;
  asm volatile("movl %%cr2,%0" : "=r" (val));
801067c4:	0f 20 d3             	mov    %cr2,%ebx
801067c7:	89 5d f8             	mov    %ebx,-0x8(%ebp)
  return val;
801067ca:	8b 45 f8             	mov    -0x8(%ebp),%eax
}
801067cd:	83 c4 10             	add    $0x10,%esp
801067d0:	5b                   	pop    %ebx
801067d1:	5d                   	pop    %ebp
801067d2:	c3                   	ret    

801067d3 <tvinit>:
struct spinlock tickslock;
uint ticks;

void
tvinit(void)
{
801067d3:	55                   	push   %ebp
801067d4:	89 e5                	mov    %esp,%ebp
801067d6:	83 ec 28             	sub    $0x28,%esp
  int i;

  for(i = 0; i < 256; i++)
801067d9:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
801067e0:	e9 c3 00 00 00       	jmp    801068a8 <tvinit+0xd5>
    SETGATE(idt[i], 0, SEG_KCODE<<3, vectors[i], 0);
801067e5:	8b 45 f4             	mov    -0xc(%ebp),%eax
801067e8:	8b 04 85 cc b0 10 80 	mov    -0x7fef4f34(,%eax,4),%eax
801067ef:	89 c2                	mov    %eax,%edx
801067f1:	8b 45 f4             	mov    -0xc(%ebp),%eax
801067f4:	66 89 14 c5 e0 40 11 	mov    %dx,-0x7feebf20(,%eax,8)
801067fb:	80 
801067fc:	8b 45 f4             	mov    -0xc(%ebp),%eax
801067ff:	66 c7 04 c5 e2 40 11 	movw   $0x8,-0x7feebf1e(,%eax,8)
80106806:	80 08 00 
80106809:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010680c:	0f b6 14 c5 e4 40 11 	movzbl -0x7feebf1c(,%eax,8),%edx
80106813:	80 
80106814:	83 e2 e0             	and    $0xffffffe0,%edx
80106817:	88 14 c5 e4 40 11 80 	mov    %dl,-0x7feebf1c(,%eax,8)
8010681e:	8b 45 f4             	mov    -0xc(%ebp),%eax
80106821:	0f b6 14 c5 e4 40 11 	movzbl -0x7feebf1c(,%eax,8),%edx
80106828:	80 
80106829:	83 e2 1f             	and    $0x1f,%edx
8010682c:	88 14 c5 e4 40 11 80 	mov    %dl,-0x7feebf1c(,%eax,8)
80106833:	8b 45 f4             	mov    -0xc(%ebp),%eax
80106836:	0f b6 14 c5 e5 40 11 	movzbl -0x7feebf1b(,%eax,8),%edx
8010683d:	80 
8010683e:	83 e2 f0             	and    $0xfffffff0,%edx
80106841:	83 ca 0e             	or     $0xe,%edx
80106844:	88 14 c5 e5 40 11 80 	mov    %dl,-0x7feebf1b(,%eax,8)
8010684b:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010684e:	0f b6 14 c5 e5 40 11 	movzbl -0x7feebf1b(,%eax,8),%edx
80106855:	80 
80106856:	83 e2 ef             	and    $0xffffffef,%edx
80106859:	88 14 c5 e5 40 11 80 	mov    %dl,-0x7feebf1b(,%eax,8)
80106860:	8b 45 f4             	mov    -0xc(%ebp),%eax
80106863:	0f b6 14 c5 e5 40 11 	movzbl -0x7feebf1b(,%eax,8),%edx
8010686a:	80 
8010686b:	83 e2 9f             	and    $0xffffff9f,%edx
8010686e:	88 14 c5 e5 40 11 80 	mov    %dl,-0x7feebf1b(,%eax,8)
80106875:	8b 45 f4             	mov    -0xc(%ebp),%eax
80106878:	0f b6 14 c5 e5 40 11 	movzbl -0x7feebf1b(,%eax,8),%edx
8010687f:	80 
80106880:	83 ca 80             	or     $0xffffff80,%edx
80106883:	88 14 c5 e5 40 11 80 	mov    %dl,-0x7feebf1b(,%eax,8)
8010688a:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010688d:	8b 04 85 cc b0 10 80 	mov    -0x7fef4f34(,%eax,4),%eax
80106894:	c1 e8 10             	shr    $0x10,%eax
80106897:	89 c2                	mov    %eax,%edx
80106899:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010689c:	66 89 14 c5 e6 40 11 	mov    %dx,-0x7feebf1a(,%eax,8)
801068a3:	80 
void
tvinit(void)
{
  int i;

  for(i = 0; i < 256; i++)
801068a4:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
801068a8:	81 7d f4 ff 00 00 00 	cmpl   $0xff,-0xc(%ebp)
801068af:	0f 8e 30 ff ff ff    	jle    801067e5 <tvinit+0x12>
    SETGATE(idt[i], 0, SEG_KCODE<<3, vectors[i], 0);
  SETGATE(idt[T_SYSCALL], 1, SEG_KCODE<<3, vectors[T_SYSCALL], DPL_USER);
801068b5:	a1 cc b1 10 80       	mov    0x8010b1cc,%eax
801068ba:	66 a3 e0 42 11 80    	mov    %ax,0x801142e0
801068c0:	66 c7 05 e2 42 11 80 	movw   $0x8,0x801142e2
801068c7:	08 00 
801068c9:	0f b6 05 e4 42 11 80 	movzbl 0x801142e4,%eax
801068d0:	83 e0 e0             	and    $0xffffffe0,%eax
801068d3:	a2 e4 42 11 80       	mov    %al,0x801142e4
801068d8:	0f b6 05 e4 42 11 80 	movzbl 0x801142e4,%eax
801068df:	83 e0 1f             	and    $0x1f,%eax
801068e2:	a2 e4 42 11 80       	mov    %al,0x801142e4
801068e7:	0f b6 05 e5 42 11 80 	movzbl 0x801142e5,%eax
801068ee:	83 c8 0f             	or     $0xf,%eax
801068f1:	a2 e5 42 11 80       	mov    %al,0x801142e5
801068f6:	0f b6 05 e5 42 11 80 	movzbl 0x801142e5,%eax
801068fd:	83 e0 ef             	and    $0xffffffef,%eax
80106900:	a2 e5 42 11 80       	mov    %al,0x801142e5
80106905:	0f b6 05 e5 42 11 80 	movzbl 0x801142e5,%eax
8010690c:	83 c8 60             	or     $0x60,%eax
8010690f:	a2 e5 42 11 80       	mov    %al,0x801142e5
80106914:	0f b6 05 e5 42 11 80 	movzbl 0x801142e5,%eax
8010691b:	83 c8 80             	or     $0xffffff80,%eax
8010691e:	a2 e5 42 11 80       	mov    %al,0x801142e5
80106923:	a1 cc b1 10 80       	mov    0x8010b1cc,%eax
80106928:	c1 e8 10             	shr    $0x10,%eax
8010692b:	66 a3 e6 42 11 80    	mov    %ax,0x801142e6
  
  initlock(&tickslock, "time");
80106931:	c7 44 24 04 84 8b 10 	movl   $0x80108b84,0x4(%esp)
80106938:	80 
80106939:	c7 04 24 a0 40 11 80 	movl   $0x801140a0,(%esp)
80106940:	e8 b1 e6 ff ff       	call   80104ff6 <initlock>
}
80106945:	c9                   	leave  
80106946:	c3                   	ret    

80106947 <idtinit>:

void
idtinit(void)
{
80106947:	55                   	push   %ebp
80106948:	89 e5                	mov    %esp,%ebp
8010694a:	83 ec 08             	sub    $0x8,%esp
  lidt(idt, sizeof(idt));
8010694d:	c7 44 24 04 00 08 00 	movl   $0x800,0x4(%esp)
80106954:	00 
80106955:	c7 04 24 e0 40 11 80 	movl   $0x801140e0,(%esp)
8010695c:	e8 33 fe ff ff       	call   80106794 <lidt>
}
80106961:	c9                   	leave  
80106962:	c3                   	ret    

80106963 <trap>:

//PAGEBREAK: 41
void
trap(struct trapframe *tf)
{
80106963:	55                   	push   %ebp
80106964:	89 e5                	mov    %esp,%ebp
80106966:	57                   	push   %edi
80106967:	56                   	push   %esi
80106968:	53                   	push   %ebx
80106969:	83 ec 3c             	sub    $0x3c,%esp
  if(tf->trapno == T_SYSCALL){
8010696c:	8b 45 08             	mov    0x8(%ebp),%eax
8010696f:	8b 40 30             	mov    0x30(%eax),%eax
80106972:	83 f8 40             	cmp    $0x40,%eax
80106975:	75 3e                	jne    801069b5 <trap+0x52>
    if(proc->killed)
80106977:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
8010697d:	8b 40 24             	mov    0x24(%eax),%eax
80106980:	85 c0                	test   %eax,%eax
80106982:	74 05                	je     80106989 <trap+0x26>
      exit();
80106984:	e8 a9 db ff ff       	call   80104532 <exit>
    proc->tf = tf;
80106989:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
8010698f:	8b 55 08             	mov    0x8(%ebp),%edx
80106992:	89 50 18             	mov    %edx,0x18(%eax)
    syscall();
80106995:	e8 05 ed ff ff       	call   8010569f <syscall>
    if(proc->killed)
8010699a:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
801069a0:	8b 40 24             	mov    0x24(%eax),%eax
801069a3:	85 c0                	test   %eax,%eax
801069a5:	0f 84 3e 02 00 00    	je     80106be9 <trap+0x286>
      exit();
801069ab:	e8 82 db ff ff       	call   80104532 <exit>
    return;
801069b0:	e9 34 02 00 00       	jmp    80106be9 <trap+0x286>
  }

  switch(tf->trapno){
801069b5:	8b 45 08             	mov    0x8(%ebp),%eax
801069b8:	8b 40 30             	mov    0x30(%eax),%eax
801069bb:	83 e8 20             	sub    $0x20,%eax
801069be:	83 f8 1f             	cmp    $0x1f,%eax
801069c1:	0f 87 c6 00 00 00    	ja     80106a8d <trap+0x12a>
801069c7:	8b 04 85 2c 8c 10 80 	mov    -0x7fef73d4(,%eax,4),%eax
801069ce:	ff e0                	jmp    *%eax
  case T_IRQ0 + IRQ_TIMER:
    if(cpu->id == 0){
801069d0:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
801069d6:	0f b6 00             	movzbl (%eax),%eax
801069d9:	84 c0                	test   %al,%al
801069db:	75 3b                	jne    80106a18 <trap+0xb5>
      acquire(&tickslock);
801069dd:	c7 04 24 a0 40 11 80 	movl   $0x801140a0,(%esp)
801069e4:	e8 2e e6 ff ff       	call   80105017 <acquire>
      ticks++;
801069e9:	a1 e0 48 11 80       	mov    0x801148e0,%eax
801069ee:	83 c0 01             	add    $0x1,%eax
801069f1:	a3 e0 48 11 80       	mov    %eax,0x801148e0

      /** OUR ADDITION - 1.6 **/
      updateTicks();
801069f6:	e8 e4 e4 ff ff       	call   80104edf <updateTicks>
      raiseAlarm();
801069fb:	e8 3a e5 ff ff       	call   80104f3a <raiseAlarm>

      wakeup(&ticks);
80106a00:	c7 04 24 e0 48 11 80 	movl   $0x801148e0,(%esp)
80106a07:	e8 12 e1 ff ff       	call   80104b1e <wakeup>
      release(&tickslock);
80106a0c:	c7 04 24 a0 40 11 80 	movl   $0x801140a0,(%esp)
80106a13:	e8 61 e6 ff ff       	call   80105079 <release>
    }
    lapiceoi();
80106a18:	e8 1c c5 ff ff       	call   80102f39 <lapiceoi>
    break;
80106a1d:	e9 41 01 00 00       	jmp    80106b63 <trap+0x200>
  case T_IRQ0 + IRQ_IDE:
    ideintr();
80106a22:	e8 16 bd ff ff       	call   8010273d <ideintr>
    lapiceoi();
80106a27:	e8 0d c5 ff ff       	call   80102f39 <lapiceoi>
    break;
80106a2c:	e9 32 01 00 00       	jmp    80106b63 <trap+0x200>
  case T_IRQ0 + IRQ_IDE+1:
    // Bochs generates spurious IDE1 interrupts.
    break;
  case T_IRQ0 + IRQ_KBD:
    kbdintr();
80106a31:	e8 df c2 ff ff       	call   80102d15 <kbdintr>
    lapiceoi();
80106a36:	e8 fe c4 ff ff       	call   80102f39 <lapiceoi>
    break;
80106a3b:	e9 23 01 00 00       	jmp    80106b63 <trap+0x200>
  case T_IRQ0 + IRQ_COM1:
    uartintr();
80106a40:	e8 ab 03 00 00       	call   80106df0 <uartintr>
    lapiceoi();
80106a45:	e8 ef c4 ff ff       	call   80102f39 <lapiceoi>
    break;
80106a4a:	e9 14 01 00 00       	jmp    80106b63 <trap+0x200>
  case T_IRQ0 + 7:
  case T_IRQ0 + IRQ_SPURIOUS:
    cprintf("cpu%d: spurious interrupt at %x:%x\n",
            cpu->id, tf->cs, tf->eip);
80106a4f:	8b 45 08             	mov    0x8(%ebp),%eax
    uartintr();
    lapiceoi();
    break;
  case T_IRQ0 + 7:
  case T_IRQ0 + IRQ_SPURIOUS:
    cprintf("cpu%d: spurious interrupt at %x:%x\n",
80106a52:	8b 48 38             	mov    0x38(%eax),%ecx
            cpu->id, tf->cs, tf->eip);
80106a55:	8b 45 08             	mov    0x8(%ebp),%eax
80106a58:	0f b7 40 3c          	movzwl 0x3c(%eax),%eax
    uartintr();
    lapiceoi();
    break;
  case T_IRQ0 + 7:
  case T_IRQ0 + IRQ_SPURIOUS:
    cprintf("cpu%d: spurious interrupt at %x:%x\n",
80106a5c:	0f b7 d0             	movzwl %ax,%edx
            cpu->id, tf->cs, tf->eip);
80106a5f:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
80106a65:	0f b6 00             	movzbl (%eax),%eax
    uartintr();
    lapiceoi();
    break;
  case T_IRQ0 + 7:
  case T_IRQ0 + IRQ_SPURIOUS:
    cprintf("cpu%d: spurious interrupt at %x:%x\n",
80106a68:	0f b6 c0             	movzbl %al,%eax
80106a6b:	89 4c 24 0c          	mov    %ecx,0xc(%esp)
80106a6f:	89 54 24 08          	mov    %edx,0x8(%esp)
80106a73:	89 44 24 04          	mov    %eax,0x4(%esp)
80106a77:	c7 04 24 8c 8b 10 80 	movl   $0x80108b8c,(%esp)
80106a7e:	e8 27 99 ff ff       	call   801003aa <cprintf>
            cpu->id, tf->cs, tf->eip);
    lapiceoi();
80106a83:	e8 b1 c4 ff ff       	call   80102f39 <lapiceoi>
    break;
80106a88:	e9 d6 00 00 00       	jmp    80106b63 <trap+0x200>
   
  //PAGEBREAK: 13
  default:
    if(proc == 0 || (tf->cs&3) == 0){
80106a8d:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80106a93:	85 c0                	test   %eax,%eax
80106a95:	74 11                	je     80106aa8 <trap+0x145>
80106a97:	8b 45 08             	mov    0x8(%ebp),%eax
80106a9a:	0f b7 40 3c          	movzwl 0x3c(%eax),%eax
80106a9e:	0f b7 c0             	movzwl %ax,%eax
80106aa1:	83 e0 03             	and    $0x3,%eax
80106aa4:	85 c0                	test   %eax,%eax
80106aa6:	75 46                	jne    80106aee <trap+0x18b>
      // In kernel, it must be our mistake.
      cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n",
80106aa8:	e8 10 fd ff ff       	call   801067bd <rcr2>
              tf->trapno, cpu->id, tf->eip, rcr2());
80106aad:	8b 55 08             	mov    0x8(%ebp),%edx
   
  //PAGEBREAK: 13
  default:
    if(proc == 0 || (tf->cs&3) == 0){
      // In kernel, it must be our mistake.
      cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n",
80106ab0:	8b 5a 38             	mov    0x38(%edx),%ebx
              tf->trapno, cpu->id, tf->eip, rcr2());
80106ab3:	65 8b 15 00 00 00 00 	mov    %gs:0x0,%edx
80106aba:	0f b6 12             	movzbl (%edx),%edx
   
  //PAGEBREAK: 13
  default:
    if(proc == 0 || (tf->cs&3) == 0){
      // In kernel, it must be our mistake.
      cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n",
80106abd:	0f b6 ca             	movzbl %dl,%ecx
              tf->trapno, cpu->id, tf->eip, rcr2());
80106ac0:	8b 55 08             	mov    0x8(%ebp),%edx
   
  //PAGEBREAK: 13
  default:
    if(proc == 0 || (tf->cs&3) == 0){
      // In kernel, it must be our mistake.
      cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n",
80106ac3:	8b 52 30             	mov    0x30(%edx),%edx
80106ac6:	89 44 24 10          	mov    %eax,0x10(%esp)
80106aca:	89 5c 24 0c          	mov    %ebx,0xc(%esp)
80106ace:	89 4c 24 08          	mov    %ecx,0x8(%esp)
80106ad2:	89 54 24 04          	mov    %edx,0x4(%esp)
80106ad6:	c7 04 24 b0 8b 10 80 	movl   $0x80108bb0,(%esp)
80106add:	e8 c8 98 ff ff       	call   801003aa <cprintf>
              tf->trapno, cpu->id, tf->eip, rcr2());
      panic("trap");
80106ae2:	c7 04 24 e2 8b 10 80 	movl   $0x80108be2,(%esp)
80106ae9:	e8 58 9a ff ff       	call   80100546 <panic>
    }
    // In user space, assume process misbehaved.
    cprintf("pid %d %s: trap %d err %d on cpu %d "
80106aee:	e8 ca fc ff ff       	call   801067bd <rcr2>
80106af3:	89 c2                	mov    %eax,%edx
            "eip 0x%x addr 0x%x--kill proc\n",
            proc->pid, proc->name, tf->trapno, tf->err, cpu->id, tf->eip, 
80106af5:	8b 45 08             	mov    0x8(%ebp),%eax
      cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n",
              tf->trapno, cpu->id, tf->eip, rcr2());
      panic("trap");
    }
    // In user space, assume process misbehaved.
    cprintf("pid %d %s: trap %d err %d on cpu %d "
80106af8:	8b 78 38             	mov    0x38(%eax),%edi
            "eip 0x%x addr 0x%x--kill proc\n",
            proc->pid, proc->name, tf->trapno, tf->err, cpu->id, tf->eip, 
80106afb:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
80106b01:	0f b6 00             	movzbl (%eax),%eax
      cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n",
              tf->trapno, cpu->id, tf->eip, rcr2());
      panic("trap");
    }
    // In user space, assume process misbehaved.
    cprintf("pid %d %s: trap %d err %d on cpu %d "
80106b04:	0f b6 f0             	movzbl %al,%esi
            "eip 0x%x addr 0x%x--kill proc\n",
            proc->pid, proc->name, tf->trapno, tf->err, cpu->id, tf->eip, 
80106b07:	8b 45 08             	mov    0x8(%ebp),%eax
      cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n",
              tf->trapno, cpu->id, tf->eip, rcr2());
      panic("trap");
    }
    // In user space, assume process misbehaved.
    cprintf("pid %d %s: trap %d err %d on cpu %d "
80106b0a:	8b 58 34             	mov    0x34(%eax),%ebx
            "eip 0x%x addr 0x%x--kill proc\n",
            proc->pid, proc->name, tf->trapno, tf->err, cpu->id, tf->eip, 
80106b0d:	8b 45 08             	mov    0x8(%ebp),%eax
      cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n",
              tf->trapno, cpu->id, tf->eip, rcr2());
      panic("trap");
    }
    // In user space, assume process misbehaved.
    cprintf("pid %d %s: trap %d err %d on cpu %d "
80106b10:	8b 48 30             	mov    0x30(%eax),%ecx
            "eip 0x%x addr 0x%x--kill proc\n",
            proc->pid, proc->name, tf->trapno, tf->err, cpu->id, tf->eip, 
80106b13:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80106b19:	83 c0 6c             	add    $0x6c,%eax
80106b1c:	89 45 e4             	mov    %eax,-0x1c(%ebp)
80106b1f:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
      cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n",
              tf->trapno, cpu->id, tf->eip, rcr2());
      panic("trap");
    }
    // In user space, assume process misbehaved.
    cprintf("pid %d %s: trap %d err %d on cpu %d "
80106b25:	8b 40 10             	mov    0x10(%eax),%eax
80106b28:	89 54 24 1c          	mov    %edx,0x1c(%esp)
80106b2c:	89 7c 24 18          	mov    %edi,0x18(%esp)
80106b30:	89 74 24 14          	mov    %esi,0x14(%esp)
80106b34:	89 5c 24 10          	mov    %ebx,0x10(%esp)
80106b38:	89 4c 24 0c          	mov    %ecx,0xc(%esp)
80106b3c:	8b 55 e4             	mov    -0x1c(%ebp),%edx
80106b3f:	89 54 24 08          	mov    %edx,0x8(%esp)
80106b43:	89 44 24 04          	mov    %eax,0x4(%esp)
80106b47:	c7 04 24 e8 8b 10 80 	movl   $0x80108be8,(%esp)
80106b4e:	e8 57 98 ff ff       	call   801003aa <cprintf>
            "eip 0x%x addr 0x%x--kill proc\n",
            proc->pid, proc->name, tf->trapno, tf->err, cpu->id, tf->eip, 
            rcr2());
    proc->killed = 1;
80106b53:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80106b59:	c7 40 24 01 00 00 00 	movl   $0x1,0x24(%eax)
80106b60:	eb 01                	jmp    80106b63 <trap+0x200>
    ideintr();
    lapiceoi();
    break;
  case T_IRQ0 + IRQ_IDE+1:
    // Bochs generates spurious IDE1 interrupts.
    break;
80106b62:	90                   	nop
  }

  // Force process exit if it has been killed and is in user space.
  // (If it is still executing in the kernel, let it keep running 
  // until it gets to the regular system call return.)
  if(proc && proc->killed && (tf->cs&3) == DPL_USER)
80106b63:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80106b69:	85 c0                	test   %eax,%eax
80106b6b:	74 24                	je     80106b91 <trap+0x22e>
80106b6d:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80106b73:	8b 40 24             	mov    0x24(%eax),%eax
80106b76:	85 c0                	test   %eax,%eax
80106b78:	74 17                	je     80106b91 <trap+0x22e>
80106b7a:	8b 45 08             	mov    0x8(%ebp),%eax
80106b7d:	0f b7 40 3c          	movzwl 0x3c(%eax),%eax
80106b81:	0f b7 c0             	movzwl %ax,%eax
80106b84:	83 e0 03             	and    $0x3,%eax
80106b87:	83 f8 03             	cmp    $0x3,%eax
80106b8a:	75 05                	jne    80106b91 <trap+0x22e>
    exit();
80106b8c:	e8 a1 d9 ff ff       	call   80104532 <exit>

  // Force process to give up CPU on clock tick.
  // If interrupts were on while locks held, would need to check nlock.
  if(proc && proc->state == RUNNING && tf->trapno == T_IRQ0+IRQ_TIMER)
80106b91:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80106b97:	85 c0                	test   %eax,%eax
80106b99:	74 1e                	je     80106bb9 <trap+0x256>
80106b9b:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80106ba1:	8b 40 0c             	mov    0xc(%eax),%eax
80106ba4:	83 f8 04             	cmp    $0x4,%eax
80106ba7:	75 10                	jne    80106bb9 <trap+0x256>
80106ba9:	8b 45 08             	mov    0x8(%ebp),%eax
80106bac:	8b 40 30             	mov    0x30(%eax),%eax
80106baf:	83 f8 20             	cmp    $0x20,%eax
80106bb2:	75 05                	jne    80106bb9 <trap+0x256>
    yield();
80106bb4:	e8 2b de ff ff       	call   801049e4 <yield>

  // Check if the process has been killed since we yielded
  if(proc && proc->killed && (tf->cs&3) == DPL_USER)
80106bb9:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80106bbf:	85 c0                	test   %eax,%eax
80106bc1:	74 27                	je     80106bea <trap+0x287>
80106bc3:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
80106bc9:	8b 40 24             	mov    0x24(%eax),%eax
80106bcc:	85 c0                	test   %eax,%eax
80106bce:	74 1a                	je     80106bea <trap+0x287>
80106bd0:	8b 45 08             	mov    0x8(%ebp),%eax
80106bd3:	0f b7 40 3c          	movzwl 0x3c(%eax),%eax
80106bd7:	0f b7 c0             	movzwl %ax,%eax
80106bda:	83 e0 03             	and    $0x3,%eax
80106bdd:	83 f8 03             	cmp    $0x3,%eax
80106be0:	75 08                	jne    80106bea <trap+0x287>
    exit();
80106be2:	e8 4b d9 ff ff       	call   80104532 <exit>
80106be7:	eb 01                	jmp    80106bea <trap+0x287>
      exit();
    proc->tf = tf;
    syscall();
    if(proc->killed)
      exit();
    return;
80106be9:	90                   	nop
    yield();

  // Check if the process has been killed since we yielded
  if(proc && proc->killed && (tf->cs&3) == DPL_USER)
    exit();
}
80106bea:	83 c4 3c             	add    $0x3c,%esp
80106bed:	5b                   	pop    %ebx
80106bee:	5e                   	pop    %esi
80106bef:	5f                   	pop    %edi
80106bf0:	5d                   	pop    %ebp
80106bf1:	c3                   	ret    
80106bf2:	66 90                	xchg   %ax,%ax

80106bf4 <inb>:
// Routines to let C code use special x86 instructions.

static inline uchar
inb(ushort port)
{
80106bf4:	55                   	push   %ebp
80106bf5:	89 e5                	mov    %esp,%ebp
80106bf7:	53                   	push   %ebx
80106bf8:	83 ec 14             	sub    $0x14,%esp
80106bfb:	8b 45 08             	mov    0x8(%ebp),%eax
80106bfe:	66 89 45 e8          	mov    %ax,-0x18(%ebp)
  uchar data;

  asm volatile("in %1,%0" : "=a" (data) : "d" (port));
80106c02:	0f b7 55 e8          	movzwl -0x18(%ebp),%edx
80106c06:	66 89 55 ea          	mov    %dx,-0x16(%ebp)
80106c0a:	0f b7 55 ea          	movzwl -0x16(%ebp),%edx
80106c0e:	ec                   	in     (%dx),%al
80106c0f:	89 c3                	mov    %eax,%ebx
80106c11:	88 5d fb             	mov    %bl,-0x5(%ebp)
  return data;
80106c14:	0f b6 45 fb          	movzbl -0x5(%ebp),%eax
}
80106c18:	83 c4 14             	add    $0x14,%esp
80106c1b:	5b                   	pop    %ebx
80106c1c:	5d                   	pop    %ebp
80106c1d:	c3                   	ret    

80106c1e <outb>:
               "memory", "cc");
}

static inline void
outb(ushort port, uchar data)
{
80106c1e:	55                   	push   %ebp
80106c1f:	89 e5                	mov    %esp,%ebp
80106c21:	83 ec 08             	sub    $0x8,%esp
80106c24:	8b 55 08             	mov    0x8(%ebp),%edx
80106c27:	8b 45 0c             	mov    0xc(%ebp),%eax
80106c2a:	66 89 55 fc          	mov    %dx,-0x4(%ebp)
80106c2e:	88 45 f8             	mov    %al,-0x8(%ebp)
  asm volatile("out %0,%1" : : "a" (data), "d" (port));
80106c31:	0f b6 45 f8          	movzbl -0x8(%ebp),%eax
80106c35:	0f b7 55 fc          	movzwl -0x4(%ebp),%edx
80106c39:	ee                   	out    %al,(%dx)
}
80106c3a:	c9                   	leave  
80106c3b:	c3                   	ret    

80106c3c <uartinit>:

static int uart;    // is there a uart?

void
uartinit(void)
{
80106c3c:	55                   	push   %ebp
80106c3d:	89 e5                	mov    %esp,%ebp
80106c3f:	83 ec 28             	sub    $0x28,%esp
  char *p;

  // Turn off the FIFO
  outb(COM1+2, 0);
80106c42:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
80106c49:	00 
80106c4a:	c7 04 24 fa 03 00 00 	movl   $0x3fa,(%esp)
80106c51:	e8 c8 ff ff ff       	call   80106c1e <outb>
  
  // 9600 baud, 8 data bits, 1 stop bit, parity off.
  outb(COM1+3, 0x80);    // Unlock divisor
80106c56:	c7 44 24 04 80 00 00 	movl   $0x80,0x4(%esp)
80106c5d:	00 
80106c5e:	c7 04 24 fb 03 00 00 	movl   $0x3fb,(%esp)
80106c65:	e8 b4 ff ff ff       	call   80106c1e <outb>
  outb(COM1+0, 115200/9600);
80106c6a:	c7 44 24 04 0c 00 00 	movl   $0xc,0x4(%esp)
80106c71:	00 
80106c72:	c7 04 24 f8 03 00 00 	movl   $0x3f8,(%esp)
80106c79:	e8 a0 ff ff ff       	call   80106c1e <outb>
  outb(COM1+1, 0);
80106c7e:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
80106c85:	00 
80106c86:	c7 04 24 f9 03 00 00 	movl   $0x3f9,(%esp)
80106c8d:	e8 8c ff ff ff       	call   80106c1e <outb>
  outb(COM1+3, 0x03);    // Lock divisor, 8 data bits.
80106c92:	c7 44 24 04 03 00 00 	movl   $0x3,0x4(%esp)
80106c99:	00 
80106c9a:	c7 04 24 fb 03 00 00 	movl   $0x3fb,(%esp)
80106ca1:	e8 78 ff ff ff       	call   80106c1e <outb>
  outb(COM1+4, 0);
80106ca6:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
80106cad:	00 
80106cae:	c7 04 24 fc 03 00 00 	movl   $0x3fc,(%esp)
80106cb5:	e8 64 ff ff ff       	call   80106c1e <outb>
  outb(COM1+1, 0x01);    // Enable receive interrupts.
80106cba:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
80106cc1:	00 
80106cc2:	c7 04 24 f9 03 00 00 	movl   $0x3f9,(%esp)
80106cc9:	e8 50 ff ff ff       	call   80106c1e <outb>

  // If status is 0xFF, no serial port.
  if(inb(COM1+5) == 0xFF)
80106cce:	c7 04 24 fd 03 00 00 	movl   $0x3fd,(%esp)
80106cd5:	e8 1a ff ff ff       	call   80106bf4 <inb>
80106cda:	3c ff                	cmp    $0xff,%al
80106cdc:	74 6c                	je     80106d4a <uartinit+0x10e>
    return;
  uart = 1;
80106cde:	c7 05 8c b6 10 80 01 	movl   $0x1,0x8010b68c
80106ce5:	00 00 00 

  // Acknowledge pre-existing interrupt conditions;
  // enable interrupts.
  inb(COM1+2);
80106ce8:	c7 04 24 fa 03 00 00 	movl   $0x3fa,(%esp)
80106cef:	e8 00 ff ff ff       	call   80106bf4 <inb>
  inb(COM1+0);
80106cf4:	c7 04 24 f8 03 00 00 	movl   $0x3f8,(%esp)
80106cfb:	e8 f4 fe ff ff       	call   80106bf4 <inb>
  picenable(IRQ_COM1);
80106d00:	c7 04 24 04 00 00 00 	movl   $0x4,(%esp)
80106d07:	e8 11 ce ff ff       	call   80103b1d <picenable>
  ioapicenable(IRQ_COM1, 0);
80106d0c:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
80106d13:	00 
80106d14:	c7 04 24 04 00 00 00 	movl   $0x4,(%esp)
80106d1b:	e8 a2 bc ff ff       	call   801029c2 <ioapicenable>
  
  // Announce that we're here.
  for(p="xv6...\n"; *p; p++)
80106d20:	c7 45 f4 ac 8c 10 80 	movl   $0x80108cac,-0xc(%ebp)
80106d27:	eb 15                	jmp    80106d3e <uartinit+0x102>
    uartputc(*p);
80106d29:	8b 45 f4             	mov    -0xc(%ebp),%eax
80106d2c:	0f b6 00             	movzbl (%eax),%eax
80106d2f:	0f be c0             	movsbl %al,%eax
80106d32:	89 04 24             	mov    %eax,(%esp)
80106d35:	e8 13 00 00 00       	call   80106d4d <uartputc>
  inb(COM1+0);
  picenable(IRQ_COM1);
  ioapicenable(IRQ_COM1, 0);
  
  // Announce that we're here.
  for(p="xv6...\n"; *p; p++)
80106d3a:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
80106d3e:	8b 45 f4             	mov    -0xc(%ebp),%eax
80106d41:	0f b6 00             	movzbl (%eax),%eax
80106d44:	84 c0                	test   %al,%al
80106d46:	75 e1                	jne    80106d29 <uartinit+0xed>
80106d48:	eb 01                	jmp    80106d4b <uartinit+0x10f>
  outb(COM1+4, 0);
  outb(COM1+1, 0x01);    // Enable receive interrupts.

  // If status is 0xFF, no serial port.
  if(inb(COM1+5) == 0xFF)
    return;
80106d4a:	90                   	nop
  ioapicenable(IRQ_COM1, 0);
  
  // Announce that we're here.
  for(p="xv6...\n"; *p; p++)
    uartputc(*p);
}
80106d4b:	c9                   	leave  
80106d4c:	c3                   	ret    

80106d4d <uartputc>:

void
uartputc(int c)
{
80106d4d:	55                   	push   %ebp
80106d4e:	89 e5                	mov    %esp,%ebp
80106d50:	83 ec 28             	sub    $0x28,%esp
  int i;

  if(!uart)
80106d53:	a1 8c b6 10 80       	mov    0x8010b68c,%eax
80106d58:	85 c0                	test   %eax,%eax
80106d5a:	74 4d                	je     80106da9 <uartputc+0x5c>
    return;
  for(i = 0; i < 128 && !(inb(COM1+5) & 0x20); i++)
80106d5c:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
80106d63:	eb 10                	jmp    80106d75 <uartputc+0x28>
    microdelay(10);
80106d65:	c7 04 24 0a 00 00 00 	movl   $0xa,(%esp)
80106d6c:	e8 ed c1 ff ff       	call   80102f5e <microdelay>
{
  int i;

  if(!uart)
    return;
  for(i = 0; i < 128 && !(inb(COM1+5) & 0x20); i++)
80106d71:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
80106d75:	83 7d f4 7f          	cmpl   $0x7f,-0xc(%ebp)
80106d79:	7f 16                	jg     80106d91 <uartputc+0x44>
80106d7b:	c7 04 24 fd 03 00 00 	movl   $0x3fd,(%esp)
80106d82:	e8 6d fe ff ff       	call   80106bf4 <inb>
80106d87:	0f b6 c0             	movzbl %al,%eax
80106d8a:	83 e0 20             	and    $0x20,%eax
80106d8d:	85 c0                	test   %eax,%eax
80106d8f:	74 d4                	je     80106d65 <uartputc+0x18>
    microdelay(10);
  outb(COM1+0, c);
80106d91:	8b 45 08             	mov    0x8(%ebp),%eax
80106d94:	0f b6 c0             	movzbl %al,%eax
80106d97:	89 44 24 04          	mov    %eax,0x4(%esp)
80106d9b:	c7 04 24 f8 03 00 00 	movl   $0x3f8,(%esp)
80106da2:	e8 77 fe ff ff       	call   80106c1e <outb>
80106da7:	eb 01                	jmp    80106daa <uartputc+0x5d>
uartputc(int c)
{
  int i;

  if(!uart)
    return;
80106da9:	90                   	nop
  for(i = 0; i < 128 && !(inb(COM1+5) & 0x20); i++)
    microdelay(10);
  outb(COM1+0, c);
}
80106daa:	c9                   	leave  
80106dab:	c3                   	ret    

80106dac <uartgetc>:

static int
uartgetc(void)
{
80106dac:	55                   	push   %ebp
80106dad:	89 e5                	mov    %esp,%ebp
80106daf:	83 ec 04             	sub    $0x4,%esp
  if(!uart)
80106db2:	a1 8c b6 10 80       	mov    0x8010b68c,%eax
80106db7:	85 c0                	test   %eax,%eax
80106db9:	75 07                	jne    80106dc2 <uartgetc+0x16>
    return -1;
80106dbb:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80106dc0:	eb 2c                	jmp    80106dee <uartgetc+0x42>
  if(!(inb(COM1+5) & 0x01))
80106dc2:	c7 04 24 fd 03 00 00 	movl   $0x3fd,(%esp)
80106dc9:	e8 26 fe ff ff       	call   80106bf4 <inb>
80106dce:	0f b6 c0             	movzbl %al,%eax
80106dd1:	83 e0 01             	and    $0x1,%eax
80106dd4:	85 c0                	test   %eax,%eax
80106dd6:	75 07                	jne    80106ddf <uartgetc+0x33>
    return -1;
80106dd8:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80106ddd:	eb 0f                	jmp    80106dee <uartgetc+0x42>
  return inb(COM1+0);
80106ddf:	c7 04 24 f8 03 00 00 	movl   $0x3f8,(%esp)
80106de6:	e8 09 fe ff ff       	call   80106bf4 <inb>
80106deb:	0f b6 c0             	movzbl %al,%eax
}
80106dee:	c9                   	leave  
80106def:	c3                   	ret    

80106df0 <uartintr>:

void
uartintr(void)
{
80106df0:	55                   	push   %ebp
80106df1:	89 e5                	mov    %esp,%ebp
80106df3:	83 ec 18             	sub    $0x18,%esp
  consoleintr(uartgetc);
80106df6:	c7 04 24 ac 6d 10 80 	movl   $0x80106dac,(%esp)
80106dfd:	e8 b4 99 ff ff       	call   801007b6 <consoleintr>
}
80106e02:	c9                   	leave  
80106e03:	c3                   	ret    

80106e04 <vector0>:
# generated by vectors.pl - do not edit
# handlers
.globl alltraps
.globl vector0
vector0:
  pushl $0
80106e04:	6a 00                	push   $0x0
  pushl $0
80106e06:	6a 00                	push   $0x0
  jmp alltraps
80106e08:	e9 5b f9 ff ff       	jmp    80106768 <alltraps>

80106e0d <vector1>:
.globl vector1
vector1:
  pushl $0
80106e0d:	6a 00                	push   $0x0
  pushl $1
80106e0f:	6a 01                	push   $0x1
  jmp alltraps
80106e11:	e9 52 f9 ff ff       	jmp    80106768 <alltraps>

80106e16 <vector2>:
.globl vector2
vector2:
  pushl $0
80106e16:	6a 00                	push   $0x0
  pushl $2
80106e18:	6a 02                	push   $0x2
  jmp alltraps
80106e1a:	e9 49 f9 ff ff       	jmp    80106768 <alltraps>

80106e1f <vector3>:
.globl vector3
vector3:
  pushl $0
80106e1f:	6a 00                	push   $0x0
  pushl $3
80106e21:	6a 03                	push   $0x3
  jmp alltraps
80106e23:	e9 40 f9 ff ff       	jmp    80106768 <alltraps>

80106e28 <vector4>:
.globl vector4
vector4:
  pushl $0
80106e28:	6a 00                	push   $0x0
  pushl $4
80106e2a:	6a 04                	push   $0x4
  jmp alltraps
80106e2c:	e9 37 f9 ff ff       	jmp    80106768 <alltraps>

80106e31 <vector5>:
.globl vector5
vector5:
  pushl $0
80106e31:	6a 00                	push   $0x0
  pushl $5
80106e33:	6a 05                	push   $0x5
  jmp alltraps
80106e35:	e9 2e f9 ff ff       	jmp    80106768 <alltraps>

80106e3a <vector6>:
.globl vector6
vector6:
  pushl $0
80106e3a:	6a 00                	push   $0x0
  pushl $6
80106e3c:	6a 06                	push   $0x6
  jmp alltraps
80106e3e:	e9 25 f9 ff ff       	jmp    80106768 <alltraps>

80106e43 <vector7>:
.globl vector7
vector7:
  pushl $0
80106e43:	6a 00                	push   $0x0
  pushl $7
80106e45:	6a 07                	push   $0x7
  jmp alltraps
80106e47:	e9 1c f9 ff ff       	jmp    80106768 <alltraps>

80106e4c <vector8>:
.globl vector8
vector8:
  pushl $8
80106e4c:	6a 08                	push   $0x8
  jmp alltraps
80106e4e:	e9 15 f9 ff ff       	jmp    80106768 <alltraps>

80106e53 <vector9>:
.globl vector9
vector9:
  pushl $0
80106e53:	6a 00                	push   $0x0
  pushl $9
80106e55:	6a 09                	push   $0x9
  jmp alltraps
80106e57:	e9 0c f9 ff ff       	jmp    80106768 <alltraps>

80106e5c <vector10>:
.globl vector10
vector10:
  pushl $10
80106e5c:	6a 0a                	push   $0xa
  jmp alltraps
80106e5e:	e9 05 f9 ff ff       	jmp    80106768 <alltraps>

80106e63 <vector11>:
.globl vector11
vector11:
  pushl $11
80106e63:	6a 0b                	push   $0xb
  jmp alltraps
80106e65:	e9 fe f8 ff ff       	jmp    80106768 <alltraps>

80106e6a <vector12>:
.globl vector12
vector12:
  pushl $12
80106e6a:	6a 0c                	push   $0xc
  jmp alltraps
80106e6c:	e9 f7 f8 ff ff       	jmp    80106768 <alltraps>

80106e71 <vector13>:
.globl vector13
vector13:
  pushl $13
80106e71:	6a 0d                	push   $0xd
  jmp alltraps
80106e73:	e9 f0 f8 ff ff       	jmp    80106768 <alltraps>

80106e78 <vector14>:
.globl vector14
vector14:
  pushl $14
80106e78:	6a 0e                	push   $0xe
  jmp alltraps
80106e7a:	e9 e9 f8 ff ff       	jmp    80106768 <alltraps>

80106e7f <vector15>:
.globl vector15
vector15:
  pushl $0
80106e7f:	6a 00                	push   $0x0
  pushl $15
80106e81:	6a 0f                	push   $0xf
  jmp alltraps
80106e83:	e9 e0 f8 ff ff       	jmp    80106768 <alltraps>

80106e88 <vector16>:
.globl vector16
vector16:
  pushl $0
80106e88:	6a 00                	push   $0x0
  pushl $16
80106e8a:	6a 10                	push   $0x10
  jmp alltraps
80106e8c:	e9 d7 f8 ff ff       	jmp    80106768 <alltraps>

80106e91 <vector17>:
.globl vector17
vector17:
  pushl $17
80106e91:	6a 11                	push   $0x11
  jmp alltraps
80106e93:	e9 d0 f8 ff ff       	jmp    80106768 <alltraps>

80106e98 <vector18>:
.globl vector18
vector18:
  pushl $0
80106e98:	6a 00                	push   $0x0
  pushl $18
80106e9a:	6a 12                	push   $0x12
  jmp alltraps
80106e9c:	e9 c7 f8 ff ff       	jmp    80106768 <alltraps>

80106ea1 <vector19>:
.globl vector19
vector19:
  pushl $0
80106ea1:	6a 00                	push   $0x0
  pushl $19
80106ea3:	6a 13                	push   $0x13
  jmp alltraps
80106ea5:	e9 be f8 ff ff       	jmp    80106768 <alltraps>

80106eaa <vector20>:
.globl vector20
vector20:
  pushl $0
80106eaa:	6a 00                	push   $0x0
  pushl $20
80106eac:	6a 14                	push   $0x14
  jmp alltraps
80106eae:	e9 b5 f8 ff ff       	jmp    80106768 <alltraps>

80106eb3 <vector21>:
.globl vector21
vector21:
  pushl $0
80106eb3:	6a 00                	push   $0x0
  pushl $21
80106eb5:	6a 15                	push   $0x15
  jmp alltraps
80106eb7:	e9 ac f8 ff ff       	jmp    80106768 <alltraps>

80106ebc <vector22>:
.globl vector22
vector22:
  pushl $0
80106ebc:	6a 00                	push   $0x0
  pushl $22
80106ebe:	6a 16                	push   $0x16
  jmp alltraps
80106ec0:	e9 a3 f8 ff ff       	jmp    80106768 <alltraps>

80106ec5 <vector23>:
.globl vector23
vector23:
  pushl $0
80106ec5:	6a 00                	push   $0x0
  pushl $23
80106ec7:	6a 17                	push   $0x17
  jmp alltraps
80106ec9:	e9 9a f8 ff ff       	jmp    80106768 <alltraps>

80106ece <vector24>:
.globl vector24
vector24:
  pushl $0
80106ece:	6a 00                	push   $0x0
  pushl $24
80106ed0:	6a 18                	push   $0x18
  jmp alltraps
80106ed2:	e9 91 f8 ff ff       	jmp    80106768 <alltraps>

80106ed7 <vector25>:
.globl vector25
vector25:
  pushl $0
80106ed7:	6a 00                	push   $0x0
  pushl $25
80106ed9:	6a 19                	push   $0x19
  jmp alltraps
80106edb:	e9 88 f8 ff ff       	jmp    80106768 <alltraps>

80106ee0 <vector26>:
.globl vector26
vector26:
  pushl $0
80106ee0:	6a 00                	push   $0x0
  pushl $26
80106ee2:	6a 1a                	push   $0x1a
  jmp alltraps
80106ee4:	e9 7f f8 ff ff       	jmp    80106768 <alltraps>

80106ee9 <vector27>:
.globl vector27
vector27:
  pushl $0
80106ee9:	6a 00                	push   $0x0
  pushl $27
80106eeb:	6a 1b                	push   $0x1b
  jmp alltraps
80106eed:	e9 76 f8 ff ff       	jmp    80106768 <alltraps>

80106ef2 <vector28>:
.globl vector28
vector28:
  pushl $0
80106ef2:	6a 00                	push   $0x0
  pushl $28
80106ef4:	6a 1c                	push   $0x1c
  jmp alltraps
80106ef6:	e9 6d f8 ff ff       	jmp    80106768 <alltraps>

80106efb <vector29>:
.globl vector29
vector29:
  pushl $0
80106efb:	6a 00                	push   $0x0
  pushl $29
80106efd:	6a 1d                	push   $0x1d
  jmp alltraps
80106eff:	e9 64 f8 ff ff       	jmp    80106768 <alltraps>

80106f04 <vector30>:
.globl vector30
vector30:
  pushl $0
80106f04:	6a 00                	push   $0x0
  pushl $30
80106f06:	6a 1e                	push   $0x1e
  jmp alltraps
80106f08:	e9 5b f8 ff ff       	jmp    80106768 <alltraps>

80106f0d <vector31>:
.globl vector31
vector31:
  pushl $0
80106f0d:	6a 00                	push   $0x0
  pushl $31
80106f0f:	6a 1f                	push   $0x1f
  jmp alltraps
80106f11:	e9 52 f8 ff ff       	jmp    80106768 <alltraps>

80106f16 <vector32>:
.globl vector32
vector32:
  pushl $0
80106f16:	6a 00                	push   $0x0
  pushl $32
80106f18:	6a 20                	push   $0x20
  jmp alltraps
80106f1a:	e9 49 f8 ff ff       	jmp    80106768 <alltraps>

80106f1f <vector33>:
.globl vector33
vector33:
  pushl $0
80106f1f:	6a 00                	push   $0x0
  pushl $33
80106f21:	6a 21                	push   $0x21
  jmp alltraps
80106f23:	e9 40 f8 ff ff       	jmp    80106768 <alltraps>

80106f28 <vector34>:
.globl vector34
vector34:
  pushl $0
80106f28:	6a 00                	push   $0x0
  pushl $34
80106f2a:	6a 22                	push   $0x22
  jmp alltraps
80106f2c:	e9 37 f8 ff ff       	jmp    80106768 <alltraps>

80106f31 <vector35>:
.globl vector35
vector35:
  pushl $0
80106f31:	6a 00                	push   $0x0
  pushl $35
80106f33:	6a 23                	push   $0x23
  jmp alltraps
80106f35:	e9 2e f8 ff ff       	jmp    80106768 <alltraps>

80106f3a <vector36>:
.globl vector36
vector36:
  pushl $0
80106f3a:	6a 00                	push   $0x0
  pushl $36
80106f3c:	6a 24                	push   $0x24
  jmp alltraps
80106f3e:	e9 25 f8 ff ff       	jmp    80106768 <alltraps>

80106f43 <vector37>:
.globl vector37
vector37:
  pushl $0
80106f43:	6a 00                	push   $0x0
  pushl $37
80106f45:	6a 25                	push   $0x25
  jmp alltraps
80106f47:	e9 1c f8 ff ff       	jmp    80106768 <alltraps>

80106f4c <vector38>:
.globl vector38
vector38:
  pushl $0
80106f4c:	6a 00                	push   $0x0
  pushl $38
80106f4e:	6a 26                	push   $0x26
  jmp alltraps
80106f50:	e9 13 f8 ff ff       	jmp    80106768 <alltraps>

80106f55 <vector39>:
.globl vector39
vector39:
  pushl $0
80106f55:	6a 00                	push   $0x0
  pushl $39
80106f57:	6a 27                	push   $0x27
  jmp alltraps
80106f59:	e9 0a f8 ff ff       	jmp    80106768 <alltraps>

80106f5e <vector40>:
.globl vector40
vector40:
  pushl $0
80106f5e:	6a 00                	push   $0x0
  pushl $40
80106f60:	6a 28                	push   $0x28
  jmp alltraps
80106f62:	e9 01 f8 ff ff       	jmp    80106768 <alltraps>

80106f67 <vector41>:
.globl vector41
vector41:
  pushl $0
80106f67:	6a 00                	push   $0x0
  pushl $41
80106f69:	6a 29                	push   $0x29
  jmp alltraps
80106f6b:	e9 f8 f7 ff ff       	jmp    80106768 <alltraps>

80106f70 <vector42>:
.globl vector42
vector42:
  pushl $0
80106f70:	6a 00                	push   $0x0
  pushl $42
80106f72:	6a 2a                	push   $0x2a
  jmp alltraps
80106f74:	e9 ef f7 ff ff       	jmp    80106768 <alltraps>

80106f79 <vector43>:
.globl vector43
vector43:
  pushl $0
80106f79:	6a 00                	push   $0x0
  pushl $43
80106f7b:	6a 2b                	push   $0x2b
  jmp alltraps
80106f7d:	e9 e6 f7 ff ff       	jmp    80106768 <alltraps>

80106f82 <vector44>:
.globl vector44
vector44:
  pushl $0
80106f82:	6a 00                	push   $0x0
  pushl $44
80106f84:	6a 2c                	push   $0x2c
  jmp alltraps
80106f86:	e9 dd f7 ff ff       	jmp    80106768 <alltraps>

80106f8b <vector45>:
.globl vector45
vector45:
  pushl $0
80106f8b:	6a 00                	push   $0x0
  pushl $45
80106f8d:	6a 2d                	push   $0x2d
  jmp alltraps
80106f8f:	e9 d4 f7 ff ff       	jmp    80106768 <alltraps>

80106f94 <vector46>:
.globl vector46
vector46:
  pushl $0
80106f94:	6a 00                	push   $0x0
  pushl $46
80106f96:	6a 2e                	push   $0x2e
  jmp alltraps
80106f98:	e9 cb f7 ff ff       	jmp    80106768 <alltraps>

80106f9d <vector47>:
.globl vector47
vector47:
  pushl $0
80106f9d:	6a 00                	push   $0x0
  pushl $47
80106f9f:	6a 2f                	push   $0x2f
  jmp alltraps
80106fa1:	e9 c2 f7 ff ff       	jmp    80106768 <alltraps>

80106fa6 <vector48>:
.globl vector48
vector48:
  pushl $0
80106fa6:	6a 00                	push   $0x0
  pushl $48
80106fa8:	6a 30                	push   $0x30
  jmp alltraps
80106faa:	e9 b9 f7 ff ff       	jmp    80106768 <alltraps>

80106faf <vector49>:
.globl vector49
vector49:
  pushl $0
80106faf:	6a 00                	push   $0x0
  pushl $49
80106fb1:	6a 31                	push   $0x31
  jmp alltraps
80106fb3:	e9 b0 f7 ff ff       	jmp    80106768 <alltraps>

80106fb8 <vector50>:
.globl vector50
vector50:
  pushl $0
80106fb8:	6a 00                	push   $0x0
  pushl $50
80106fba:	6a 32                	push   $0x32
  jmp alltraps
80106fbc:	e9 a7 f7 ff ff       	jmp    80106768 <alltraps>

80106fc1 <vector51>:
.globl vector51
vector51:
  pushl $0
80106fc1:	6a 00                	push   $0x0
  pushl $51
80106fc3:	6a 33                	push   $0x33
  jmp alltraps
80106fc5:	e9 9e f7 ff ff       	jmp    80106768 <alltraps>

80106fca <vector52>:
.globl vector52
vector52:
  pushl $0
80106fca:	6a 00                	push   $0x0
  pushl $52
80106fcc:	6a 34                	push   $0x34
  jmp alltraps
80106fce:	e9 95 f7 ff ff       	jmp    80106768 <alltraps>

80106fd3 <vector53>:
.globl vector53
vector53:
  pushl $0
80106fd3:	6a 00                	push   $0x0
  pushl $53
80106fd5:	6a 35                	push   $0x35
  jmp alltraps
80106fd7:	e9 8c f7 ff ff       	jmp    80106768 <alltraps>

80106fdc <vector54>:
.globl vector54
vector54:
  pushl $0
80106fdc:	6a 00                	push   $0x0
  pushl $54
80106fde:	6a 36                	push   $0x36
  jmp alltraps
80106fe0:	e9 83 f7 ff ff       	jmp    80106768 <alltraps>

80106fe5 <vector55>:
.globl vector55
vector55:
  pushl $0
80106fe5:	6a 00                	push   $0x0
  pushl $55
80106fe7:	6a 37                	push   $0x37
  jmp alltraps
80106fe9:	e9 7a f7 ff ff       	jmp    80106768 <alltraps>

80106fee <vector56>:
.globl vector56
vector56:
  pushl $0
80106fee:	6a 00                	push   $0x0
  pushl $56
80106ff0:	6a 38                	push   $0x38
  jmp alltraps
80106ff2:	e9 71 f7 ff ff       	jmp    80106768 <alltraps>

80106ff7 <vector57>:
.globl vector57
vector57:
  pushl $0
80106ff7:	6a 00                	push   $0x0
  pushl $57
80106ff9:	6a 39                	push   $0x39
  jmp alltraps
80106ffb:	e9 68 f7 ff ff       	jmp    80106768 <alltraps>

80107000 <vector58>:
.globl vector58
vector58:
  pushl $0
80107000:	6a 00                	push   $0x0
  pushl $58
80107002:	6a 3a                	push   $0x3a
  jmp alltraps
80107004:	e9 5f f7 ff ff       	jmp    80106768 <alltraps>

80107009 <vector59>:
.globl vector59
vector59:
  pushl $0
80107009:	6a 00                	push   $0x0
  pushl $59
8010700b:	6a 3b                	push   $0x3b
  jmp alltraps
8010700d:	e9 56 f7 ff ff       	jmp    80106768 <alltraps>

80107012 <vector60>:
.globl vector60
vector60:
  pushl $0
80107012:	6a 00                	push   $0x0
  pushl $60
80107014:	6a 3c                	push   $0x3c
  jmp alltraps
80107016:	e9 4d f7 ff ff       	jmp    80106768 <alltraps>

8010701b <vector61>:
.globl vector61
vector61:
  pushl $0
8010701b:	6a 00                	push   $0x0
  pushl $61
8010701d:	6a 3d                	push   $0x3d
  jmp alltraps
8010701f:	e9 44 f7 ff ff       	jmp    80106768 <alltraps>

80107024 <vector62>:
.globl vector62
vector62:
  pushl $0
80107024:	6a 00                	push   $0x0
  pushl $62
80107026:	6a 3e                	push   $0x3e
  jmp alltraps
80107028:	e9 3b f7 ff ff       	jmp    80106768 <alltraps>

8010702d <vector63>:
.globl vector63
vector63:
  pushl $0
8010702d:	6a 00                	push   $0x0
  pushl $63
8010702f:	6a 3f                	push   $0x3f
  jmp alltraps
80107031:	e9 32 f7 ff ff       	jmp    80106768 <alltraps>

80107036 <vector64>:
.globl vector64
vector64:
  pushl $0
80107036:	6a 00                	push   $0x0
  pushl $64
80107038:	6a 40                	push   $0x40
  jmp alltraps
8010703a:	e9 29 f7 ff ff       	jmp    80106768 <alltraps>

8010703f <vector65>:
.globl vector65
vector65:
  pushl $0
8010703f:	6a 00                	push   $0x0
  pushl $65
80107041:	6a 41                	push   $0x41
  jmp alltraps
80107043:	e9 20 f7 ff ff       	jmp    80106768 <alltraps>

80107048 <vector66>:
.globl vector66
vector66:
  pushl $0
80107048:	6a 00                	push   $0x0
  pushl $66
8010704a:	6a 42                	push   $0x42
  jmp alltraps
8010704c:	e9 17 f7 ff ff       	jmp    80106768 <alltraps>

80107051 <vector67>:
.globl vector67
vector67:
  pushl $0
80107051:	6a 00                	push   $0x0
  pushl $67
80107053:	6a 43                	push   $0x43
  jmp alltraps
80107055:	e9 0e f7 ff ff       	jmp    80106768 <alltraps>

8010705a <vector68>:
.globl vector68
vector68:
  pushl $0
8010705a:	6a 00                	push   $0x0
  pushl $68
8010705c:	6a 44                	push   $0x44
  jmp alltraps
8010705e:	e9 05 f7 ff ff       	jmp    80106768 <alltraps>

80107063 <vector69>:
.globl vector69
vector69:
  pushl $0
80107063:	6a 00                	push   $0x0
  pushl $69
80107065:	6a 45                	push   $0x45
  jmp alltraps
80107067:	e9 fc f6 ff ff       	jmp    80106768 <alltraps>

8010706c <vector70>:
.globl vector70
vector70:
  pushl $0
8010706c:	6a 00                	push   $0x0
  pushl $70
8010706e:	6a 46                	push   $0x46
  jmp alltraps
80107070:	e9 f3 f6 ff ff       	jmp    80106768 <alltraps>

80107075 <vector71>:
.globl vector71
vector71:
  pushl $0
80107075:	6a 00                	push   $0x0
  pushl $71
80107077:	6a 47                	push   $0x47
  jmp alltraps
80107079:	e9 ea f6 ff ff       	jmp    80106768 <alltraps>

8010707e <vector72>:
.globl vector72
vector72:
  pushl $0
8010707e:	6a 00                	push   $0x0
  pushl $72
80107080:	6a 48                	push   $0x48
  jmp alltraps
80107082:	e9 e1 f6 ff ff       	jmp    80106768 <alltraps>

80107087 <vector73>:
.globl vector73
vector73:
  pushl $0
80107087:	6a 00                	push   $0x0
  pushl $73
80107089:	6a 49                	push   $0x49
  jmp alltraps
8010708b:	e9 d8 f6 ff ff       	jmp    80106768 <alltraps>

80107090 <vector74>:
.globl vector74
vector74:
  pushl $0
80107090:	6a 00                	push   $0x0
  pushl $74
80107092:	6a 4a                	push   $0x4a
  jmp alltraps
80107094:	e9 cf f6 ff ff       	jmp    80106768 <alltraps>

80107099 <vector75>:
.globl vector75
vector75:
  pushl $0
80107099:	6a 00                	push   $0x0
  pushl $75
8010709b:	6a 4b                	push   $0x4b
  jmp alltraps
8010709d:	e9 c6 f6 ff ff       	jmp    80106768 <alltraps>

801070a2 <vector76>:
.globl vector76
vector76:
  pushl $0
801070a2:	6a 00                	push   $0x0
  pushl $76
801070a4:	6a 4c                	push   $0x4c
  jmp alltraps
801070a6:	e9 bd f6 ff ff       	jmp    80106768 <alltraps>

801070ab <vector77>:
.globl vector77
vector77:
  pushl $0
801070ab:	6a 00                	push   $0x0
  pushl $77
801070ad:	6a 4d                	push   $0x4d
  jmp alltraps
801070af:	e9 b4 f6 ff ff       	jmp    80106768 <alltraps>

801070b4 <vector78>:
.globl vector78
vector78:
  pushl $0
801070b4:	6a 00                	push   $0x0
  pushl $78
801070b6:	6a 4e                	push   $0x4e
  jmp alltraps
801070b8:	e9 ab f6 ff ff       	jmp    80106768 <alltraps>

801070bd <vector79>:
.globl vector79
vector79:
  pushl $0
801070bd:	6a 00                	push   $0x0
  pushl $79
801070bf:	6a 4f                	push   $0x4f
  jmp alltraps
801070c1:	e9 a2 f6 ff ff       	jmp    80106768 <alltraps>

801070c6 <vector80>:
.globl vector80
vector80:
  pushl $0
801070c6:	6a 00                	push   $0x0
  pushl $80
801070c8:	6a 50                	push   $0x50
  jmp alltraps
801070ca:	e9 99 f6 ff ff       	jmp    80106768 <alltraps>

801070cf <vector81>:
.globl vector81
vector81:
  pushl $0
801070cf:	6a 00                	push   $0x0
  pushl $81
801070d1:	6a 51                	push   $0x51
  jmp alltraps
801070d3:	e9 90 f6 ff ff       	jmp    80106768 <alltraps>

801070d8 <vector82>:
.globl vector82
vector82:
  pushl $0
801070d8:	6a 00                	push   $0x0
  pushl $82
801070da:	6a 52                	push   $0x52
  jmp alltraps
801070dc:	e9 87 f6 ff ff       	jmp    80106768 <alltraps>

801070e1 <vector83>:
.globl vector83
vector83:
  pushl $0
801070e1:	6a 00                	push   $0x0
  pushl $83
801070e3:	6a 53                	push   $0x53
  jmp alltraps
801070e5:	e9 7e f6 ff ff       	jmp    80106768 <alltraps>

801070ea <vector84>:
.globl vector84
vector84:
  pushl $0
801070ea:	6a 00                	push   $0x0
  pushl $84
801070ec:	6a 54                	push   $0x54
  jmp alltraps
801070ee:	e9 75 f6 ff ff       	jmp    80106768 <alltraps>

801070f3 <vector85>:
.globl vector85
vector85:
  pushl $0
801070f3:	6a 00                	push   $0x0
  pushl $85
801070f5:	6a 55                	push   $0x55
  jmp alltraps
801070f7:	e9 6c f6 ff ff       	jmp    80106768 <alltraps>

801070fc <vector86>:
.globl vector86
vector86:
  pushl $0
801070fc:	6a 00                	push   $0x0
  pushl $86
801070fe:	6a 56                	push   $0x56
  jmp alltraps
80107100:	e9 63 f6 ff ff       	jmp    80106768 <alltraps>

80107105 <vector87>:
.globl vector87
vector87:
  pushl $0
80107105:	6a 00                	push   $0x0
  pushl $87
80107107:	6a 57                	push   $0x57
  jmp alltraps
80107109:	e9 5a f6 ff ff       	jmp    80106768 <alltraps>

8010710e <vector88>:
.globl vector88
vector88:
  pushl $0
8010710e:	6a 00                	push   $0x0
  pushl $88
80107110:	6a 58                	push   $0x58
  jmp alltraps
80107112:	e9 51 f6 ff ff       	jmp    80106768 <alltraps>

80107117 <vector89>:
.globl vector89
vector89:
  pushl $0
80107117:	6a 00                	push   $0x0
  pushl $89
80107119:	6a 59                	push   $0x59
  jmp alltraps
8010711b:	e9 48 f6 ff ff       	jmp    80106768 <alltraps>

80107120 <vector90>:
.globl vector90
vector90:
  pushl $0
80107120:	6a 00                	push   $0x0
  pushl $90
80107122:	6a 5a                	push   $0x5a
  jmp alltraps
80107124:	e9 3f f6 ff ff       	jmp    80106768 <alltraps>

80107129 <vector91>:
.globl vector91
vector91:
  pushl $0
80107129:	6a 00                	push   $0x0
  pushl $91
8010712b:	6a 5b                	push   $0x5b
  jmp alltraps
8010712d:	e9 36 f6 ff ff       	jmp    80106768 <alltraps>

80107132 <vector92>:
.globl vector92
vector92:
  pushl $0
80107132:	6a 00                	push   $0x0
  pushl $92
80107134:	6a 5c                	push   $0x5c
  jmp alltraps
80107136:	e9 2d f6 ff ff       	jmp    80106768 <alltraps>

8010713b <vector93>:
.globl vector93
vector93:
  pushl $0
8010713b:	6a 00                	push   $0x0
  pushl $93
8010713d:	6a 5d                	push   $0x5d
  jmp alltraps
8010713f:	e9 24 f6 ff ff       	jmp    80106768 <alltraps>

80107144 <vector94>:
.globl vector94
vector94:
  pushl $0
80107144:	6a 00                	push   $0x0
  pushl $94
80107146:	6a 5e                	push   $0x5e
  jmp alltraps
80107148:	e9 1b f6 ff ff       	jmp    80106768 <alltraps>

8010714d <vector95>:
.globl vector95
vector95:
  pushl $0
8010714d:	6a 00                	push   $0x0
  pushl $95
8010714f:	6a 5f                	push   $0x5f
  jmp alltraps
80107151:	e9 12 f6 ff ff       	jmp    80106768 <alltraps>

80107156 <vector96>:
.globl vector96
vector96:
  pushl $0
80107156:	6a 00                	push   $0x0
  pushl $96
80107158:	6a 60                	push   $0x60
  jmp alltraps
8010715a:	e9 09 f6 ff ff       	jmp    80106768 <alltraps>

8010715f <vector97>:
.globl vector97
vector97:
  pushl $0
8010715f:	6a 00                	push   $0x0
  pushl $97
80107161:	6a 61                	push   $0x61
  jmp alltraps
80107163:	e9 00 f6 ff ff       	jmp    80106768 <alltraps>

80107168 <vector98>:
.globl vector98
vector98:
  pushl $0
80107168:	6a 00                	push   $0x0
  pushl $98
8010716a:	6a 62                	push   $0x62
  jmp alltraps
8010716c:	e9 f7 f5 ff ff       	jmp    80106768 <alltraps>

80107171 <vector99>:
.globl vector99
vector99:
  pushl $0
80107171:	6a 00                	push   $0x0
  pushl $99
80107173:	6a 63                	push   $0x63
  jmp alltraps
80107175:	e9 ee f5 ff ff       	jmp    80106768 <alltraps>

8010717a <vector100>:
.globl vector100
vector100:
  pushl $0
8010717a:	6a 00                	push   $0x0
  pushl $100
8010717c:	6a 64                	push   $0x64
  jmp alltraps
8010717e:	e9 e5 f5 ff ff       	jmp    80106768 <alltraps>

80107183 <vector101>:
.globl vector101
vector101:
  pushl $0
80107183:	6a 00                	push   $0x0
  pushl $101
80107185:	6a 65                	push   $0x65
  jmp alltraps
80107187:	e9 dc f5 ff ff       	jmp    80106768 <alltraps>

8010718c <vector102>:
.globl vector102
vector102:
  pushl $0
8010718c:	6a 00                	push   $0x0
  pushl $102
8010718e:	6a 66                	push   $0x66
  jmp alltraps
80107190:	e9 d3 f5 ff ff       	jmp    80106768 <alltraps>

80107195 <vector103>:
.globl vector103
vector103:
  pushl $0
80107195:	6a 00                	push   $0x0
  pushl $103
80107197:	6a 67                	push   $0x67
  jmp alltraps
80107199:	e9 ca f5 ff ff       	jmp    80106768 <alltraps>

8010719e <vector104>:
.globl vector104
vector104:
  pushl $0
8010719e:	6a 00                	push   $0x0
  pushl $104
801071a0:	6a 68                	push   $0x68
  jmp alltraps
801071a2:	e9 c1 f5 ff ff       	jmp    80106768 <alltraps>

801071a7 <vector105>:
.globl vector105
vector105:
  pushl $0
801071a7:	6a 00                	push   $0x0
  pushl $105
801071a9:	6a 69                	push   $0x69
  jmp alltraps
801071ab:	e9 b8 f5 ff ff       	jmp    80106768 <alltraps>

801071b0 <vector106>:
.globl vector106
vector106:
  pushl $0
801071b0:	6a 00                	push   $0x0
  pushl $106
801071b2:	6a 6a                	push   $0x6a
  jmp alltraps
801071b4:	e9 af f5 ff ff       	jmp    80106768 <alltraps>

801071b9 <vector107>:
.globl vector107
vector107:
  pushl $0
801071b9:	6a 00                	push   $0x0
  pushl $107
801071bb:	6a 6b                	push   $0x6b
  jmp alltraps
801071bd:	e9 a6 f5 ff ff       	jmp    80106768 <alltraps>

801071c2 <vector108>:
.globl vector108
vector108:
  pushl $0
801071c2:	6a 00                	push   $0x0
  pushl $108
801071c4:	6a 6c                	push   $0x6c
  jmp alltraps
801071c6:	e9 9d f5 ff ff       	jmp    80106768 <alltraps>

801071cb <vector109>:
.globl vector109
vector109:
  pushl $0
801071cb:	6a 00                	push   $0x0
  pushl $109
801071cd:	6a 6d                	push   $0x6d
  jmp alltraps
801071cf:	e9 94 f5 ff ff       	jmp    80106768 <alltraps>

801071d4 <vector110>:
.globl vector110
vector110:
  pushl $0
801071d4:	6a 00                	push   $0x0
  pushl $110
801071d6:	6a 6e                	push   $0x6e
  jmp alltraps
801071d8:	e9 8b f5 ff ff       	jmp    80106768 <alltraps>

801071dd <vector111>:
.globl vector111
vector111:
  pushl $0
801071dd:	6a 00                	push   $0x0
  pushl $111
801071df:	6a 6f                	push   $0x6f
  jmp alltraps
801071e1:	e9 82 f5 ff ff       	jmp    80106768 <alltraps>

801071e6 <vector112>:
.globl vector112
vector112:
  pushl $0
801071e6:	6a 00                	push   $0x0
  pushl $112
801071e8:	6a 70                	push   $0x70
  jmp alltraps
801071ea:	e9 79 f5 ff ff       	jmp    80106768 <alltraps>

801071ef <vector113>:
.globl vector113
vector113:
  pushl $0
801071ef:	6a 00                	push   $0x0
  pushl $113
801071f1:	6a 71                	push   $0x71
  jmp alltraps
801071f3:	e9 70 f5 ff ff       	jmp    80106768 <alltraps>

801071f8 <vector114>:
.globl vector114
vector114:
  pushl $0
801071f8:	6a 00                	push   $0x0
  pushl $114
801071fa:	6a 72                	push   $0x72
  jmp alltraps
801071fc:	e9 67 f5 ff ff       	jmp    80106768 <alltraps>

80107201 <vector115>:
.globl vector115
vector115:
  pushl $0
80107201:	6a 00                	push   $0x0
  pushl $115
80107203:	6a 73                	push   $0x73
  jmp alltraps
80107205:	e9 5e f5 ff ff       	jmp    80106768 <alltraps>

8010720a <vector116>:
.globl vector116
vector116:
  pushl $0
8010720a:	6a 00                	push   $0x0
  pushl $116
8010720c:	6a 74                	push   $0x74
  jmp alltraps
8010720e:	e9 55 f5 ff ff       	jmp    80106768 <alltraps>

80107213 <vector117>:
.globl vector117
vector117:
  pushl $0
80107213:	6a 00                	push   $0x0
  pushl $117
80107215:	6a 75                	push   $0x75
  jmp alltraps
80107217:	e9 4c f5 ff ff       	jmp    80106768 <alltraps>

8010721c <vector118>:
.globl vector118
vector118:
  pushl $0
8010721c:	6a 00                	push   $0x0
  pushl $118
8010721e:	6a 76                	push   $0x76
  jmp alltraps
80107220:	e9 43 f5 ff ff       	jmp    80106768 <alltraps>

80107225 <vector119>:
.globl vector119
vector119:
  pushl $0
80107225:	6a 00                	push   $0x0
  pushl $119
80107227:	6a 77                	push   $0x77
  jmp alltraps
80107229:	e9 3a f5 ff ff       	jmp    80106768 <alltraps>

8010722e <vector120>:
.globl vector120
vector120:
  pushl $0
8010722e:	6a 00                	push   $0x0
  pushl $120
80107230:	6a 78                	push   $0x78
  jmp alltraps
80107232:	e9 31 f5 ff ff       	jmp    80106768 <alltraps>

80107237 <vector121>:
.globl vector121
vector121:
  pushl $0
80107237:	6a 00                	push   $0x0
  pushl $121
80107239:	6a 79                	push   $0x79
  jmp alltraps
8010723b:	e9 28 f5 ff ff       	jmp    80106768 <alltraps>

80107240 <vector122>:
.globl vector122
vector122:
  pushl $0
80107240:	6a 00                	push   $0x0
  pushl $122
80107242:	6a 7a                	push   $0x7a
  jmp alltraps
80107244:	e9 1f f5 ff ff       	jmp    80106768 <alltraps>

80107249 <vector123>:
.globl vector123
vector123:
  pushl $0
80107249:	6a 00                	push   $0x0
  pushl $123
8010724b:	6a 7b                	push   $0x7b
  jmp alltraps
8010724d:	e9 16 f5 ff ff       	jmp    80106768 <alltraps>

80107252 <vector124>:
.globl vector124
vector124:
  pushl $0
80107252:	6a 00                	push   $0x0
  pushl $124
80107254:	6a 7c                	push   $0x7c
  jmp alltraps
80107256:	e9 0d f5 ff ff       	jmp    80106768 <alltraps>

8010725b <vector125>:
.globl vector125
vector125:
  pushl $0
8010725b:	6a 00                	push   $0x0
  pushl $125
8010725d:	6a 7d                	push   $0x7d
  jmp alltraps
8010725f:	e9 04 f5 ff ff       	jmp    80106768 <alltraps>

80107264 <vector126>:
.globl vector126
vector126:
  pushl $0
80107264:	6a 00                	push   $0x0
  pushl $126
80107266:	6a 7e                	push   $0x7e
  jmp alltraps
80107268:	e9 fb f4 ff ff       	jmp    80106768 <alltraps>

8010726d <vector127>:
.globl vector127
vector127:
  pushl $0
8010726d:	6a 00                	push   $0x0
  pushl $127
8010726f:	6a 7f                	push   $0x7f
  jmp alltraps
80107271:	e9 f2 f4 ff ff       	jmp    80106768 <alltraps>

80107276 <vector128>:
.globl vector128
vector128:
  pushl $0
80107276:	6a 00                	push   $0x0
  pushl $128
80107278:	68 80 00 00 00       	push   $0x80
  jmp alltraps
8010727d:	e9 e6 f4 ff ff       	jmp    80106768 <alltraps>

80107282 <vector129>:
.globl vector129
vector129:
  pushl $0
80107282:	6a 00                	push   $0x0
  pushl $129
80107284:	68 81 00 00 00       	push   $0x81
  jmp alltraps
80107289:	e9 da f4 ff ff       	jmp    80106768 <alltraps>

8010728e <vector130>:
.globl vector130
vector130:
  pushl $0
8010728e:	6a 00                	push   $0x0
  pushl $130
80107290:	68 82 00 00 00       	push   $0x82
  jmp alltraps
80107295:	e9 ce f4 ff ff       	jmp    80106768 <alltraps>

8010729a <vector131>:
.globl vector131
vector131:
  pushl $0
8010729a:	6a 00                	push   $0x0
  pushl $131
8010729c:	68 83 00 00 00       	push   $0x83
  jmp alltraps
801072a1:	e9 c2 f4 ff ff       	jmp    80106768 <alltraps>

801072a6 <vector132>:
.globl vector132
vector132:
  pushl $0
801072a6:	6a 00                	push   $0x0
  pushl $132
801072a8:	68 84 00 00 00       	push   $0x84
  jmp alltraps
801072ad:	e9 b6 f4 ff ff       	jmp    80106768 <alltraps>

801072b2 <vector133>:
.globl vector133
vector133:
  pushl $0
801072b2:	6a 00                	push   $0x0
  pushl $133
801072b4:	68 85 00 00 00       	push   $0x85
  jmp alltraps
801072b9:	e9 aa f4 ff ff       	jmp    80106768 <alltraps>

801072be <vector134>:
.globl vector134
vector134:
  pushl $0
801072be:	6a 00                	push   $0x0
  pushl $134
801072c0:	68 86 00 00 00       	push   $0x86
  jmp alltraps
801072c5:	e9 9e f4 ff ff       	jmp    80106768 <alltraps>

801072ca <vector135>:
.globl vector135
vector135:
  pushl $0
801072ca:	6a 00                	push   $0x0
  pushl $135
801072cc:	68 87 00 00 00       	push   $0x87
  jmp alltraps
801072d1:	e9 92 f4 ff ff       	jmp    80106768 <alltraps>

801072d6 <vector136>:
.globl vector136
vector136:
  pushl $0
801072d6:	6a 00                	push   $0x0
  pushl $136
801072d8:	68 88 00 00 00       	push   $0x88
  jmp alltraps
801072dd:	e9 86 f4 ff ff       	jmp    80106768 <alltraps>

801072e2 <vector137>:
.globl vector137
vector137:
  pushl $0
801072e2:	6a 00                	push   $0x0
  pushl $137
801072e4:	68 89 00 00 00       	push   $0x89
  jmp alltraps
801072e9:	e9 7a f4 ff ff       	jmp    80106768 <alltraps>

801072ee <vector138>:
.globl vector138
vector138:
  pushl $0
801072ee:	6a 00                	push   $0x0
  pushl $138
801072f0:	68 8a 00 00 00       	push   $0x8a
  jmp alltraps
801072f5:	e9 6e f4 ff ff       	jmp    80106768 <alltraps>

801072fa <vector139>:
.globl vector139
vector139:
  pushl $0
801072fa:	6a 00                	push   $0x0
  pushl $139
801072fc:	68 8b 00 00 00       	push   $0x8b
  jmp alltraps
80107301:	e9 62 f4 ff ff       	jmp    80106768 <alltraps>

80107306 <vector140>:
.globl vector140
vector140:
  pushl $0
80107306:	6a 00                	push   $0x0
  pushl $140
80107308:	68 8c 00 00 00       	push   $0x8c
  jmp alltraps
8010730d:	e9 56 f4 ff ff       	jmp    80106768 <alltraps>

80107312 <vector141>:
.globl vector141
vector141:
  pushl $0
80107312:	6a 00                	push   $0x0
  pushl $141
80107314:	68 8d 00 00 00       	push   $0x8d
  jmp alltraps
80107319:	e9 4a f4 ff ff       	jmp    80106768 <alltraps>

8010731e <vector142>:
.globl vector142
vector142:
  pushl $0
8010731e:	6a 00                	push   $0x0
  pushl $142
80107320:	68 8e 00 00 00       	push   $0x8e
  jmp alltraps
80107325:	e9 3e f4 ff ff       	jmp    80106768 <alltraps>

8010732a <vector143>:
.globl vector143
vector143:
  pushl $0
8010732a:	6a 00                	push   $0x0
  pushl $143
8010732c:	68 8f 00 00 00       	push   $0x8f
  jmp alltraps
80107331:	e9 32 f4 ff ff       	jmp    80106768 <alltraps>

80107336 <vector144>:
.globl vector144
vector144:
  pushl $0
80107336:	6a 00                	push   $0x0
  pushl $144
80107338:	68 90 00 00 00       	push   $0x90
  jmp alltraps
8010733d:	e9 26 f4 ff ff       	jmp    80106768 <alltraps>

80107342 <vector145>:
.globl vector145
vector145:
  pushl $0
80107342:	6a 00                	push   $0x0
  pushl $145
80107344:	68 91 00 00 00       	push   $0x91
  jmp alltraps
80107349:	e9 1a f4 ff ff       	jmp    80106768 <alltraps>

8010734e <vector146>:
.globl vector146
vector146:
  pushl $0
8010734e:	6a 00                	push   $0x0
  pushl $146
80107350:	68 92 00 00 00       	push   $0x92
  jmp alltraps
80107355:	e9 0e f4 ff ff       	jmp    80106768 <alltraps>

8010735a <vector147>:
.globl vector147
vector147:
  pushl $0
8010735a:	6a 00                	push   $0x0
  pushl $147
8010735c:	68 93 00 00 00       	push   $0x93
  jmp alltraps
80107361:	e9 02 f4 ff ff       	jmp    80106768 <alltraps>

80107366 <vector148>:
.globl vector148
vector148:
  pushl $0
80107366:	6a 00                	push   $0x0
  pushl $148
80107368:	68 94 00 00 00       	push   $0x94
  jmp alltraps
8010736d:	e9 f6 f3 ff ff       	jmp    80106768 <alltraps>

80107372 <vector149>:
.globl vector149
vector149:
  pushl $0
80107372:	6a 00                	push   $0x0
  pushl $149
80107374:	68 95 00 00 00       	push   $0x95
  jmp alltraps
80107379:	e9 ea f3 ff ff       	jmp    80106768 <alltraps>

8010737e <vector150>:
.globl vector150
vector150:
  pushl $0
8010737e:	6a 00                	push   $0x0
  pushl $150
80107380:	68 96 00 00 00       	push   $0x96
  jmp alltraps
80107385:	e9 de f3 ff ff       	jmp    80106768 <alltraps>

8010738a <vector151>:
.globl vector151
vector151:
  pushl $0
8010738a:	6a 00                	push   $0x0
  pushl $151
8010738c:	68 97 00 00 00       	push   $0x97
  jmp alltraps
80107391:	e9 d2 f3 ff ff       	jmp    80106768 <alltraps>

80107396 <vector152>:
.globl vector152
vector152:
  pushl $0
80107396:	6a 00                	push   $0x0
  pushl $152
80107398:	68 98 00 00 00       	push   $0x98
  jmp alltraps
8010739d:	e9 c6 f3 ff ff       	jmp    80106768 <alltraps>

801073a2 <vector153>:
.globl vector153
vector153:
  pushl $0
801073a2:	6a 00                	push   $0x0
  pushl $153
801073a4:	68 99 00 00 00       	push   $0x99
  jmp alltraps
801073a9:	e9 ba f3 ff ff       	jmp    80106768 <alltraps>

801073ae <vector154>:
.globl vector154
vector154:
  pushl $0
801073ae:	6a 00                	push   $0x0
  pushl $154
801073b0:	68 9a 00 00 00       	push   $0x9a
  jmp alltraps
801073b5:	e9 ae f3 ff ff       	jmp    80106768 <alltraps>

801073ba <vector155>:
.globl vector155
vector155:
  pushl $0
801073ba:	6a 00                	push   $0x0
  pushl $155
801073bc:	68 9b 00 00 00       	push   $0x9b
  jmp alltraps
801073c1:	e9 a2 f3 ff ff       	jmp    80106768 <alltraps>

801073c6 <vector156>:
.globl vector156
vector156:
  pushl $0
801073c6:	6a 00                	push   $0x0
  pushl $156
801073c8:	68 9c 00 00 00       	push   $0x9c
  jmp alltraps
801073cd:	e9 96 f3 ff ff       	jmp    80106768 <alltraps>

801073d2 <vector157>:
.globl vector157
vector157:
  pushl $0
801073d2:	6a 00                	push   $0x0
  pushl $157
801073d4:	68 9d 00 00 00       	push   $0x9d
  jmp alltraps
801073d9:	e9 8a f3 ff ff       	jmp    80106768 <alltraps>

801073de <vector158>:
.globl vector158
vector158:
  pushl $0
801073de:	6a 00                	push   $0x0
  pushl $158
801073e0:	68 9e 00 00 00       	push   $0x9e
  jmp alltraps
801073e5:	e9 7e f3 ff ff       	jmp    80106768 <alltraps>

801073ea <vector159>:
.globl vector159
vector159:
  pushl $0
801073ea:	6a 00                	push   $0x0
  pushl $159
801073ec:	68 9f 00 00 00       	push   $0x9f
  jmp alltraps
801073f1:	e9 72 f3 ff ff       	jmp    80106768 <alltraps>

801073f6 <vector160>:
.globl vector160
vector160:
  pushl $0
801073f6:	6a 00                	push   $0x0
  pushl $160
801073f8:	68 a0 00 00 00       	push   $0xa0
  jmp alltraps
801073fd:	e9 66 f3 ff ff       	jmp    80106768 <alltraps>

80107402 <vector161>:
.globl vector161
vector161:
  pushl $0
80107402:	6a 00                	push   $0x0
  pushl $161
80107404:	68 a1 00 00 00       	push   $0xa1
  jmp alltraps
80107409:	e9 5a f3 ff ff       	jmp    80106768 <alltraps>

8010740e <vector162>:
.globl vector162
vector162:
  pushl $0
8010740e:	6a 00                	push   $0x0
  pushl $162
80107410:	68 a2 00 00 00       	push   $0xa2
  jmp alltraps
80107415:	e9 4e f3 ff ff       	jmp    80106768 <alltraps>

8010741a <vector163>:
.globl vector163
vector163:
  pushl $0
8010741a:	6a 00                	push   $0x0
  pushl $163
8010741c:	68 a3 00 00 00       	push   $0xa3
  jmp alltraps
80107421:	e9 42 f3 ff ff       	jmp    80106768 <alltraps>

80107426 <vector164>:
.globl vector164
vector164:
  pushl $0
80107426:	6a 00                	push   $0x0
  pushl $164
80107428:	68 a4 00 00 00       	push   $0xa4
  jmp alltraps
8010742d:	e9 36 f3 ff ff       	jmp    80106768 <alltraps>

80107432 <vector165>:
.globl vector165
vector165:
  pushl $0
80107432:	6a 00                	push   $0x0
  pushl $165
80107434:	68 a5 00 00 00       	push   $0xa5
  jmp alltraps
80107439:	e9 2a f3 ff ff       	jmp    80106768 <alltraps>

8010743e <vector166>:
.globl vector166
vector166:
  pushl $0
8010743e:	6a 00                	push   $0x0
  pushl $166
80107440:	68 a6 00 00 00       	push   $0xa6
  jmp alltraps
80107445:	e9 1e f3 ff ff       	jmp    80106768 <alltraps>

8010744a <vector167>:
.globl vector167
vector167:
  pushl $0
8010744a:	6a 00                	push   $0x0
  pushl $167
8010744c:	68 a7 00 00 00       	push   $0xa7
  jmp alltraps
80107451:	e9 12 f3 ff ff       	jmp    80106768 <alltraps>

80107456 <vector168>:
.globl vector168
vector168:
  pushl $0
80107456:	6a 00                	push   $0x0
  pushl $168
80107458:	68 a8 00 00 00       	push   $0xa8
  jmp alltraps
8010745d:	e9 06 f3 ff ff       	jmp    80106768 <alltraps>

80107462 <vector169>:
.globl vector169
vector169:
  pushl $0
80107462:	6a 00                	push   $0x0
  pushl $169
80107464:	68 a9 00 00 00       	push   $0xa9
  jmp alltraps
80107469:	e9 fa f2 ff ff       	jmp    80106768 <alltraps>

8010746e <vector170>:
.globl vector170
vector170:
  pushl $0
8010746e:	6a 00                	push   $0x0
  pushl $170
80107470:	68 aa 00 00 00       	push   $0xaa
  jmp alltraps
80107475:	e9 ee f2 ff ff       	jmp    80106768 <alltraps>

8010747a <vector171>:
.globl vector171
vector171:
  pushl $0
8010747a:	6a 00                	push   $0x0
  pushl $171
8010747c:	68 ab 00 00 00       	push   $0xab
  jmp alltraps
80107481:	e9 e2 f2 ff ff       	jmp    80106768 <alltraps>

80107486 <vector172>:
.globl vector172
vector172:
  pushl $0
80107486:	6a 00                	push   $0x0
  pushl $172
80107488:	68 ac 00 00 00       	push   $0xac
  jmp alltraps
8010748d:	e9 d6 f2 ff ff       	jmp    80106768 <alltraps>

80107492 <vector173>:
.globl vector173
vector173:
  pushl $0
80107492:	6a 00                	push   $0x0
  pushl $173
80107494:	68 ad 00 00 00       	push   $0xad
  jmp alltraps
80107499:	e9 ca f2 ff ff       	jmp    80106768 <alltraps>

8010749e <vector174>:
.globl vector174
vector174:
  pushl $0
8010749e:	6a 00                	push   $0x0
  pushl $174
801074a0:	68 ae 00 00 00       	push   $0xae
  jmp alltraps
801074a5:	e9 be f2 ff ff       	jmp    80106768 <alltraps>

801074aa <vector175>:
.globl vector175
vector175:
  pushl $0
801074aa:	6a 00                	push   $0x0
  pushl $175
801074ac:	68 af 00 00 00       	push   $0xaf
  jmp alltraps
801074b1:	e9 b2 f2 ff ff       	jmp    80106768 <alltraps>

801074b6 <vector176>:
.globl vector176
vector176:
  pushl $0
801074b6:	6a 00                	push   $0x0
  pushl $176
801074b8:	68 b0 00 00 00       	push   $0xb0
  jmp alltraps
801074bd:	e9 a6 f2 ff ff       	jmp    80106768 <alltraps>

801074c2 <vector177>:
.globl vector177
vector177:
  pushl $0
801074c2:	6a 00                	push   $0x0
  pushl $177
801074c4:	68 b1 00 00 00       	push   $0xb1
  jmp alltraps
801074c9:	e9 9a f2 ff ff       	jmp    80106768 <alltraps>

801074ce <vector178>:
.globl vector178
vector178:
  pushl $0
801074ce:	6a 00                	push   $0x0
  pushl $178
801074d0:	68 b2 00 00 00       	push   $0xb2
  jmp alltraps
801074d5:	e9 8e f2 ff ff       	jmp    80106768 <alltraps>

801074da <vector179>:
.globl vector179
vector179:
  pushl $0
801074da:	6a 00                	push   $0x0
  pushl $179
801074dc:	68 b3 00 00 00       	push   $0xb3
  jmp alltraps
801074e1:	e9 82 f2 ff ff       	jmp    80106768 <alltraps>

801074e6 <vector180>:
.globl vector180
vector180:
  pushl $0
801074e6:	6a 00                	push   $0x0
  pushl $180
801074e8:	68 b4 00 00 00       	push   $0xb4
  jmp alltraps
801074ed:	e9 76 f2 ff ff       	jmp    80106768 <alltraps>

801074f2 <vector181>:
.globl vector181
vector181:
  pushl $0
801074f2:	6a 00                	push   $0x0
  pushl $181
801074f4:	68 b5 00 00 00       	push   $0xb5
  jmp alltraps
801074f9:	e9 6a f2 ff ff       	jmp    80106768 <alltraps>

801074fe <vector182>:
.globl vector182
vector182:
  pushl $0
801074fe:	6a 00                	push   $0x0
  pushl $182
80107500:	68 b6 00 00 00       	push   $0xb6
  jmp alltraps
80107505:	e9 5e f2 ff ff       	jmp    80106768 <alltraps>

8010750a <vector183>:
.globl vector183
vector183:
  pushl $0
8010750a:	6a 00                	push   $0x0
  pushl $183
8010750c:	68 b7 00 00 00       	push   $0xb7
  jmp alltraps
80107511:	e9 52 f2 ff ff       	jmp    80106768 <alltraps>

80107516 <vector184>:
.globl vector184
vector184:
  pushl $0
80107516:	6a 00                	push   $0x0
  pushl $184
80107518:	68 b8 00 00 00       	push   $0xb8
  jmp alltraps
8010751d:	e9 46 f2 ff ff       	jmp    80106768 <alltraps>

80107522 <vector185>:
.globl vector185
vector185:
  pushl $0
80107522:	6a 00                	push   $0x0
  pushl $185
80107524:	68 b9 00 00 00       	push   $0xb9
  jmp alltraps
80107529:	e9 3a f2 ff ff       	jmp    80106768 <alltraps>

8010752e <vector186>:
.globl vector186
vector186:
  pushl $0
8010752e:	6a 00                	push   $0x0
  pushl $186
80107530:	68 ba 00 00 00       	push   $0xba
  jmp alltraps
80107535:	e9 2e f2 ff ff       	jmp    80106768 <alltraps>

8010753a <vector187>:
.globl vector187
vector187:
  pushl $0
8010753a:	6a 00                	push   $0x0
  pushl $187
8010753c:	68 bb 00 00 00       	push   $0xbb
  jmp alltraps
80107541:	e9 22 f2 ff ff       	jmp    80106768 <alltraps>

80107546 <vector188>:
.globl vector188
vector188:
  pushl $0
80107546:	6a 00                	push   $0x0
  pushl $188
80107548:	68 bc 00 00 00       	push   $0xbc
  jmp alltraps
8010754d:	e9 16 f2 ff ff       	jmp    80106768 <alltraps>

80107552 <vector189>:
.globl vector189
vector189:
  pushl $0
80107552:	6a 00                	push   $0x0
  pushl $189
80107554:	68 bd 00 00 00       	push   $0xbd
  jmp alltraps
80107559:	e9 0a f2 ff ff       	jmp    80106768 <alltraps>

8010755e <vector190>:
.globl vector190
vector190:
  pushl $0
8010755e:	6a 00                	push   $0x0
  pushl $190
80107560:	68 be 00 00 00       	push   $0xbe
  jmp alltraps
80107565:	e9 fe f1 ff ff       	jmp    80106768 <alltraps>

8010756a <vector191>:
.globl vector191
vector191:
  pushl $0
8010756a:	6a 00                	push   $0x0
  pushl $191
8010756c:	68 bf 00 00 00       	push   $0xbf
  jmp alltraps
80107571:	e9 f2 f1 ff ff       	jmp    80106768 <alltraps>

80107576 <vector192>:
.globl vector192
vector192:
  pushl $0
80107576:	6a 00                	push   $0x0
  pushl $192
80107578:	68 c0 00 00 00       	push   $0xc0
  jmp alltraps
8010757d:	e9 e6 f1 ff ff       	jmp    80106768 <alltraps>

80107582 <vector193>:
.globl vector193
vector193:
  pushl $0
80107582:	6a 00                	push   $0x0
  pushl $193
80107584:	68 c1 00 00 00       	push   $0xc1
  jmp alltraps
80107589:	e9 da f1 ff ff       	jmp    80106768 <alltraps>

8010758e <vector194>:
.globl vector194
vector194:
  pushl $0
8010758e:	6a 00                	push   $0x0
  pushl $194
80107590:	68 c2 00 00 00       	push   $0xc2
  jmp alltraps
80107595:	e9 ce f1 ff ff       	jmp    80106768 <alltraps>

8010759a <vector195>:
.globl vector195
vector195:
  pushl $0
8010759a:	6a 00                	push   $0x0
  pushl $195
8010759c:	68 c3 00 00 00       	push   $0xc3
  jmp alltraps
801075a1:	e9 c2 f1 ff ff       	jmp    80106768 <alltraps>

801075a6 <vector196>:
.globl vector196
vector196:
  pushl $0
801075a6:	6a 00                	push   $0x0
  pushl $196
801075a8:	68 c4 00 00 00       	push   $0xc4
  jmp alltraps
801075ad:	e9 b6 f1 ff ff       	jmp    80106768 <alltraps>

801075b2 <vector197>:
.globl vector197
vector197:
  pushl $0
801075b2:	6a 00                	push   $0x0
  pushl $197
801075b4:	68 c5 00 00 00       	push   $0xc5
  jmp alltraps
801075b9:	e9 aa f1 ff ff       	jmp    80106768 <alltraps>

801075be <vector198>:
.globl vector198
vector198:
  pushl $0
801075be:	6a 00                	push   $0x0
  pushl $198
801075c0:	68 c6 00 00 00       	push   $0xc6
  jmp alltraps
801075c5:	e9 9e f1 ff ff       	jmp    80106768 <alltraps>

801075ca <vector199>:
.globl vector199
vector199:
  pushl $0
801075ca:	6a 00                	push   $0x0
  pushl $199
801075cc:	68 c7 00 00 00       	push   $0xc7
  jmp alltraps
801075d1:	e9 92 f1 ff ff       	jmp    80106768 <alltraps>

801075d6 <vector200>:
.globl vector200
vector200:
  pushl $0
801075d6:	6a 00                	push   $0x0
  pushl $200
801075d8:	68 c8 00 00 00       	push   $0xc8
  jmp alltraps
801075dd:	e9 86 f1 ff ff       	jmp    80106768 <alltraps>

801075e2 <vector201>:
.globl vector201
vector201:
  pushl $0
801075e2:	6a 00                	push   $0x0
  pushl $201
801075e4:	68 c9 00 00 00       	push   $0xc9
  jmp alltraps
801075e9:	e9 7a f1 ff ff       	jmp    80106768 <alltraps>

801075ee <vector202>:
.globl vector202
vector202:
  pushl $0
801075ee:	6a 00                	push   $0x0
  pushl $202
801075f0:	68 ca 00 00 00       	push   $0xca
  jmp alltraps
801075f5:	e9 6e f1 ff ff       	jmp    80106768 <alltraps>

801075fa <vector203>:
.globl vector203
vector203:
  pushl $0
801075fa:	6a 00                	push   $0x0
  pushl $203
801075fc:	68 cb 00 00 00       	push   $0xcb
  jmp alltraps
80107601:	e9 62 f1 ff ff       	jmp    80106768 <alltraps>

80107606 <vector204>:
.globl vector204
vector204:
  pushl $0
80107606:	6a 00                	push   $0x0
  pushl $204
80107608:	68 cc 00 00 00       	push   $0xcc
  jmp alltraps
8010760d:	e9 56 f1 ff ff       	jmp    80106768 <alltraps>

80107612 <vector205>:
.globl vector205
vector205:
  pushl $0
80107612:	6a 00                	push   $0x0
  pushl $205
80107614:	68 cd 00 00 00       	push   $0xcd
  jmp alltraps
80107619:	e9 4a f1 ff ff       	jmp    80106768 <alltraps>

8010761e <vector206>:
.globl vector206
vector206:
  pushl $0
8010761e:	6a 00                	push   $0x0
  pushl $206
80107620:	68 ce 00 00 00       	push   $0xce
  jmp alltraps
80107625:	e9 3e f1 ff ff       	jmp    80106768 <alltraps>

8010762a <vector207>:
.globl vector207
vector207:
  pushl $0
8010762a:	6a 00                	push   $0x0
  pushl $207
8010762c:	68 cf 00 00 00       	push   $0xcf
  jmp alltraps
80107631:	e9 32 f1 ff ff       	jmp    80106768 <alltraps>

80107636 <vector208>:
.globl vector208
vector208:
  pushl $0
80107636:	6a 00                	push   $0x0
  pushl $208
80107638:	68 d0 00 00 00       	push   $0xd0
  jmp alltraps
8010763d:	e9 26 f1 ff ff       	jmp    80106768 <alltraps>

80107642 <vector209>:
.globl vector209
vector209:
  pushl $0
80107642:	6a 00                	push   $0x0
  pushl $209
80107644:	68 d1 00 00 00       	push   $0xd1
  jmp alltraps
80107649:	e9 1a f1 ff ff       	jmp    80106768 <alltraps>

8010764e <vector210>:
.globl vector210
vector210:
  pushl $0
8010764e:	6a 00                	push   $0x0
  pushl $210
80107650:	68 d2 00 00 00       	push   $0xd2
  jmp alltraps
80107655:	e9 0e f1 ff ff       	jmp    80106768 <alltraps>

8010765a <vector211>:
.globl vector211
vector211:
  pushl $0
8010765a:	6a 00                	push   $0x0
  pushl $211
8010765c:	68 d3 00 00 00       	push   $0xd3
  jmp alltraps
80107661:	e9 02 f1 ff ff       	jmp    80106768 <alltraps>

80107666 <vector212>:
.globl vector212
vector212:
  pushl $0
80107666:	6a 00                	push   $0x0
  pushl $212
80107668:	68 d4 00 00 00       	push   $0xd4
  jmp alltraps
8010766d:	e9 f6 f0 ff ff       	jmp    80106768 <alltraps>

80107672 <vector213>:
.globl vector213
vector213:
  pushl $0
80107672:	6a 00                	push   $0x0
  pushl $213
80107674:	68 d5 00 00 00       	push   $0xd5
  jmp alltraps
80107679:	e9 ea f0 ff ff       	jmp    80106768 <alltraps>

8010767e <vector214>:
.globl vector214
vector214:
  pushl $0
8010767e:	6a 00                	push   $0x0
  pushl $214
80107680:	68 d6 00 00 00       	push   $0xd6
  jmp alltraps
80107685:	e9 de f0 ff ff       	jmp    80106768 <alltraps>

8010768a <vector215>:
.globl vector215
vector215:
  pushl $0
8010768a:	6a 00                	push   $0x0
  pushl $215
8010768c:	68 d7 00 00 00       	push   $0xd7
  jmp alltraps
80107691:	e9 d2 f0 ff ff       	jmp    80106768 <alltraps>

80107696 <vector216>:
.globl vector216
vector216:
  pushl $0
80107696:	6a 00                	push   $0x0
  pushl $216
80107698:	68 d8 00 00 00       	push   $0xd8
  jmp alltraps
8010769d:	e9 c6 f0 ff ff       	jmp    80106768 <alltraps>

801076a2 <vector217>:
.globl vector217
vector217:
  pushl $0
801076a2:	6a 00                	push   $0x0
  pushl $217
801076a4:	68 d9 00 00 00       	push   $0xd9
  jmp alltraps
801076a9:	e9 ba f0 ff ff       	jmp    80106768 <alltraps>

801076ae <vector218>:
.globl vector218
vector218:
  pushl $0
801076ae:	6a 00                	push   $0x0
  pushl $218
801076b0:	68 da 00 00 00       	push   $0xda
  jmp alltraps
801076b5:	e9 ae f0 ff ff       	jmp    80106768 <alltraps>

801076ba <vector219>:
.globl vector219
vector219:
  pushl $0
801076ba:	6a 00                	push   $0x0
  pushl $219
801076bc:	68 db 00 00 00       	push   $0xdb
  jmp alltraps
801076c1:	e9 a2 f0 ff ff       	jmp    80106768 <alltraps>

801076c6 <vector220>:
.globl vector220
vector220:
  pushl $0
801076c6:	6a 00                	push   $0x0
  pushl $220
801076c8:	68 dc 00 00 00       	push   $0xdc
  jmp alltraps
801076cd:	e9 96 f0 ff ff       	jmp    80106768 <alltraps>

801076d2 <vector221>:
.globl vector221
vector221:
  pushl $0
801076d2:	6a 00                	push   $0x0
  pushl $221
801076d4:	68 dd 00 00 00       	push   $0xdd
  jmp alltraps
801076d9:	e9 8a f0 ff ff       	jmp    80106768 <alltraps>

801076de <vector222>:
.globl vector222
vector222:
  pushl $0
801076de:	6a 00                	push   $0x0
  pushl $222
801076e0:	68 de 00 00 00       	push   $0xde
  jmp alltraps
801076e5:	e9 7e f0 ff ff       	jmp    80106768 <alltraps>

801076ea <vector223>:
.globl vector223
vector223:
  pushl $0
801076ea:	6a 00                	push   $0x0
  pushl $223
801076ec:	68 df 00 00 00       	push   $0xdf
  jmp alltraps
801076f1:	e9 72 f0 ff ff       	jmp    80106768 <alltraps>

801076f6 <vector224>:
.globl vector224
vector224:
  pushl $0
801076f6:	6a 00                	push   $0x0
  pushl $224
801076f8:	68 e0 00 00 00       	push   $0xe0
  jmp alltraps
801076fd:	e9 66 f0 ff ff       	jmp    80106768 <alltraps>

80107702 <vector225>:
.globl vector225
vector225:
  pushl $0
80107702:	6a 00                	push   $0x0
  pushl $225
80107704:	68 e1 00 00 00       	push   $0xe1
  jmp alltraps
80107709:	e9 5a f0 ff ff       	jmp    80106768 <alltraps>

8010770e <vector226>:
.globl vector226
vector226:
  pushl $0
8010770e:	6a 00                	push   $0x0
  pushl $226
80107710:	68 e2 00 00 00       	push   $0xe2
  jmp alltraps
80107715:	e9 4e f0 ff ff       	jmp    80106768 <alltraps>

8010771a <vector227>:
.globl vector227
vector227:
  pushl $0
8010771a:	6a 00                	push   $0x0
  pushl $227
8010771c:	68 e3 00 00 00       	push   $0xe3
  jmp alltraps
80107721:	e9 42 f0 ff ff       	jmp    80106768 <alltraps>

80107726 <vector228>:
.globl vector228
vector228:
  pushl $0
80107726:	6a 00                	push   $0x0
  pushl $228
80107728:	68 e4 00 00 00       	push   $0xe4
  jmp alltraps
8010772d:	e9 36 f0 ff ff       	jmp    80106768 <alltraps>

80107732 <vector229>:
.globl vector229
vector229:
  pushl $0
80107732:	6a 00                	push   $0x0
  pushl $229
80107734:	68 e5 00 00 00       	push   $0xe5
  jmp alltraps
80107739:	e9 2a f0 ff ff       	jmp    80106768 <alltraps>

8010773e <vector230>:
.globl vector230
vector230:
  pushl $0
8010773e:	6a 00                	push   $0x0
  pushl $230
80107740:	68 e6 00 00 00       	push   $0xe6
  jmp alltraps
80107745:	e9 1e f0 ff ff       	jmp    80106768 <alltraps>

8010774a <vector231>:
.globl vector231
vector231:
  pushl $0
8010774a:	6a 00                	push   $0x0
  pushl $231
8010774c:	68 e7 00 00 00       	push   $0xe7
  jmp alltraps
80107751:	e9 12 f0 ff ff       	jmp    80106768 <alltraps>

80107756 <vector232>:
.globl vector232
vector232:
  pushl $0
80107756:	6a 00                	push   $0x0
  pushl $232
80107758:	68 e8 00 00 00       	push   $0xe8
  jmp alltraps
8010775d:	e9 06 f0 ff ff       	jmp    80106768 <alltraps>

80107762 <vector233>:
.globl vector233
vector233:
  pushl $0
80107762:	6a 00                	push   $0x0
  pushl $233
80107764:	68 e9 00 00 00       	push   $0xe9
  jmp alltraps
80107769:	e9 fa ef ff ff       	jmp    80106768 <alltraps>

8010776e <vector234>:
.globl vector234
vector234:
  pushl $0
8010776e:	6a 00                	push   $0x0
  pushl $234
80107770:	68 ea 00 00 00       	push   $0xea
  jmp alltraps
80107775:	e9 ee ef ff ff       	jmp    80106768 <alltraps>

8010777a <vector235>:
.globl vector235
vector235:
  pushl $0
8010777a:	6a 00                	push   $0x0
  pushl $235
8010777c:	68 eb 00 00 00       	push   $0xeb
  jmp alltraps
80107781:	e9 e2 ef ff ff       	jmp    80106768 <alltraps>

80107786 <vector236>:
.globl vector236
vector236:
  pushl $0
80107786:	6a 00                	push   $0x0
  pushl $236
80107788:	68 ec 00 00 00       	push   $0xec
  jmp alltraps
8010778d:	e9 d6 ef ff ff       	jmp    80106768 <alltraps>

80107792 <vector237>:
.globl vector237
vector237:
  pushl $0
80107792:	6a 00                	push   $0x0
  pushl $237
80107794:	68 ed 00 00 00       	push   $0xed
  jmp alltraps
80107799:	e9 ca ef ff ff       	jmp    80106768 <alltraps>

8010779e <vector238>:
.globl vector238
vector238:
  pushl $0
8010779e:	6a 00                	push   $0x0
  pushl $238
801077a0:	68 ee 00 00 00       	push   $0xee
  jmp alltraps
801077a5:	e9 be ef ff ff       	jmp    80106768 <alltraps>

801077aa <vector239>:
.globl vector239
vector239:
  pushl $0
801077aa:	6a 00                	push   $0x0
  pushl $239
801077ac:	68 ef 00 00 00       	push   $0xef
  jmp alltraps
801077b1:	e9 b2 ef ff ff       	jmp    80106768 <alltraps>

801077b6 <vector240>:
.globl vector240
vector240:
  pushl $0
801077b6:	6a 00                	push   $0x0
  pushl $240
801077b8:	68 f0 00 00 00       	push   $0xf0
  jmp alltraps
801077bd:	e9 a6 ef ff ff       	jmp    80106768 <alltraps>

801077c2 <vector241>:
.globl vector241
vector241:
  pushl $0
801077c2:	6a 00                	push   $0x0
  pushl $241
801077c4:	68 f1 00 00 00       	push   $0xf1
  jmp alltraps
801077c9:	e9 9a ef ff ff       	jmp    80106768 <alltraps>

801077ce <vector242>:
.globl vector242
vector242:
  pushl $0
801077ce:	6a 00                	push   $0x0
  pushl $242
801077d0:	68 f2 00 00 00       	push   $0xf2
  jmp alltraps
801077d5:	e9 8e ef ff ff       	jmp    80106768 <alltraps>

801077da <vector243>:
.globl vector243
vector243:
  pushl $0
801077da:	6a 00                	push   $0x0
  pushl $243
801077dc:	68 f3 00 00 00       	push   $0xf3
  jmp alltraps
801077e1:	e9 82 ef ff ff       	jmp    80106768 <alltraps>

801077e6 <vector244>:
.globl vector244
vector244:
  pushl $0
801077e6:	6a 00                	push   $0x0
  pushl $244
801077e8:	68 f4 00 00 00       	push   $0xf4
  jmp alltraps
801077ed:	e9 76 ef ff ff       	jmp    80106768 <alltraps>

801077f2 <vector245>:
.globl vector245
vector245:
  pushl $0
801077f2:	6a 00                	push   $0x0
  pushl $245
801077f4:	68 f5 00 00 00       	push   $0xf5
  jmp alltraps
801077f9:	e9 6a ef ff ff       	jmp    80106768 <alltraps>

801077fe <vector246>:
.globl vector246
vector246:
  pushl $0
801077fe:	6a 00                	push   $0x0
  pushl $246
80107800:	68 f6 00 00 00       	push   $0xf6
  jmp alltraps
80107805:	e9 5e ef ff ff       	jmp    80106768 <alltraps>

8010780a <vector247>:
.globl vector247
vector247:
  pushl $0
8010780a:	6a 00                	push   $0x0
  pushl $247
8010780c:	68 f7 00 00 00       	push   $0xf7
  jmp alltraps
80107811:	e9 52 ef ff ff       	jmp    80106768 <alltraps>

80107816 <vector248>:
.globl vector248
vector248:
  pushl $0
80107816:	6a 00                	push   $0x0
  pushl $248
80107818:	68 f8 00 00 00       	push   $0xf8
  jmp alltraps
8010781d:	e9 46 ef ff ff       	jmp    80106768 <alltraps>

80107822 <vector249>:
.globl vector249
vector249:
  pushl $0
80107822:	6a 00                	push   $0x0
  pushl $249
80107824:	68 f9 00 00 00       	push   $0xf9
  jmp alltraps
80107829:	e9 3a ef ff ff       	jmp    80106768 <alltraps>

8010782e <vector250>:
.globl vector250
vector250:
  pushl $0
8010782e:	6a 00                	push   $0x0
  pushl $250
80107830:	68 fa 00 00 00       	push   $0xfa
  jmp alltraps
80107835:	e9 2e ef ff ff       	jmp    80106768 <alltraps>

8010783a <vector251>:
.globl vector251
vector251:
  pushl $0
8010783a:	6a 00                	push   $0x0
  pushl $251
8010783c:	68 fb 00 00 00       	push   $0xfb
  jmp alltraps
80107841:	e9 22 ef ff ff       	jmp    80106768 <alltraps>

80107846 <vector252>:
.globl vector252
vector252:
  pushl $0
80107846:	6a 00                	push   $0x0
  pushl $252
80107848:	68 fc 00 00 00       	push   $0xfc
  jmp alltraps
8010784d:	e9 16 ef ff ff       	jmp    80106768 <alltraps>

80107852 <vector253>:
.globl vector253
vector253:
  pushl $0
80107852:	6a 00                	push   $0x0
  pushl $253
80107854:	68 fd 00 00 00       	push   $0xfd
  jmp alltraps
80107859:	e9 0a ef ff ff       	jmp    80106768 <alltraps>

8010785e <vector254>:
.globl vector254
vector254:
  pushl $0
8010785e:	6a 00                	push   $0x0
  pushl $254
80107860:	68 fe 00 00 00       	push   $0xfe
  jmp alltraps
80107865:	e9 fe ee ff ff       	jmp    80106768 <alltraps>

8010786a <vector255>:
.globl vector255
vector255:
  pushl $0
8010786a:	6a 00                	push   $0x0
  pushl $255
8010786c:	68 ff 00 00 00       	push   $0xff
  jmp alltraps
80107871:	e9 f2 ee ff ff       	jmp    80106768 <alltraps>
80107876:	66 90                	xchg   %ax,%ax

80107878 <lgdt>:

struct segdesc;

static inline void
lgdt(struct segdesc *p, int size)
{
80107878:	55                   	push   %ebp
80107879:	89 e5                	mov    %esp,%ebp
8010787b:	83 ec 10             	sub    $0x10,%esp
  volatile ushort pd[3];

  pd[0] = size-1;
8010787e:	8b 45 0c             	mov    0xc(%ebp),%eax
80107881:	83 e8 01             	sub    $0x1,%eax
80107884:	66 89 45 fa          	mov    %ax,-0x6(%ebp)
  pd[1] = (uint)p;
80107888:	8b 45 08             	mov    0x8(%ebp),%eax
8010788b:	66 89 45 fc          	mov    %ax,-0x4(%ebp)
  pd[2] = (uint)p >> 16;
8010788f:	8b 45 08             	mov    0x8(%ebp),%eax
80107892:	c1 e8 10             	shr    $0x10,%eax
80107895:	66 89 45 fe          	mov    %ax,-0x2(%ebp)

  asm volatile("lgdt (%0)" : : "r" (pd));
80107899:	8d 45 fa             	lea    -0x6(%ebp),%eax
8010789c:	0f 01 10             	lgdtl  (%eax)
}
8010789f:	c9                   	leave  
801078a0:	c3                   	ret    

801078a1 <ltr>:
  asm volatile("lidt (%0)" : : "r" (pd));
}

static inline void
ltr(ushort sel)
{
801078a1:	55                   	push   %ebp
801078a2:	89 e5                	mov    %esp,%ebp
801078a4:	83 ec 04             	sub    $0x4,%esp
801078a7:	8b 45 08             	mov    0x8(%ebp),%eax
801078aa:	66 89 45 fc          	mov    %ax,-0x4(%ebp)
  asm volatile("ltr %0" : : "r" (sel));
801078ae:	0f b7 45 fc          	movzwl -0x4(%ebp),%eax
801078b2:	0f 00 d8             	ltr    %ax
}
801078b5:	c9                   	leave  
801078b6:	c3                   	ret    

801078b7 <loadgs>:
  return eflags;
}

static inline void
loadgs(ushort v)
{
801078b7:	55                   	push   %ebp
801078b8:	89 e5                	mov    %esp,%ebp
801078ba:	83 ec 04             	sub    $0x4,%esp
801078bd:	8b 45 08             	mov    0x8(%ebp),%eax
801078c0:	66 89 45 fc          	mov    %ax,-0x4(%ebp)
  asm volatile("movw %0, %%gs" : : "r" (v));
801078c4:	0f b7 45 fc          	movzwl -0x4(%ebp),%eax
801078c8:	8e e8                	mov    %eax,%gs
}
801078ca:	c9                   	leave  
801078cb:	c3                   	ret    

801078cc <lcr3>:
  return val;
}

static inline void
lcr3(uint val) 
{
801078cc:	55                   	push   %ebp
801078cd:	89 e5                	mov    %esp,%ebp
  asm volatile("movl %0,%%cr3" : : "r" (val));
801078cf:	8b 45 08             	mov    0x8(%ebp),%eax
801078d2:	0f 22 d8             	mov    %eax,%cr3
}
801078d5:	5d                   	pop    %ebp
801078d6:	c3                   	ret    

801078d7 <v2p>:
#define KERNBASE 0x80000000         // First kernel virtual address
#define KERNLINK (KERNBASE+EXTMEM)  // Address where kernel is linked

#ifndef __ASSEMBLER__

static inline uint v2p(void *a) { return ((uint) (a))  - KERNBASE; }
801078d7:	55                   	push   %ebp
801078d8:	89 e5                	mov    %esp,%ebp
801078da:	8b 45 08             	mov    0x8(%ebp),%eax
801078dd:	05 00 00 00 80       	add    $0x80000000,%eax
801078e2:	5d                   	pop    %ebp
801078e3:	c3                   	ret    

801078e4 <p2v>:
static inline void *p2v(uint a) { return (void *) ((a) + KERNBASE); }
801078e4:	55                   	push   %ebp
801078e5:	89 e5                	mov    %esp,%ebp
801078e7:	8b 45 08             	mov    0x8(%ebp),%eax
801078ea:	05 00 00 00 80       	add    $0x80000000,%eax
801078ef:	5d                   	pop    %ebp
801078f0:	c3                   	ret    

801078f1 <seginit>:

// Set up CPU's kernel segment descriptors.
// Run once on entry on each CPU.
void
seginit(void)
{
801078f1:	55                   	push   %ebp
801078f2:	89 e5                	mov    %esp,%ebp
801078f4:	53                   	push   %ebx
801078f5:	83 ec 24             	sub    $0x24,%esp

  // Map "logical" addresses to virtual addresses using identity map.
  // Cannot share a CODE descriptor for both kernel and user
  // because it would have to have DPL_USR, but the CPU forbids
  // an interrupt from CPL=0 to DPL=3.
  c = &cpus[cpunum()];
801078f8:	e8 e0 b5 ff ff       	call   80102edd <cpunum>
801078fd:	69 c0 bc 00 00 00    	imul   $0xbc,%eax,%eax
80107903:	05 60 f9 10 80       	add    $0x8010f960,%eax
80107908:	89 45 f4             	mov    %eax,-0xc(%ebp)
  c->gdt[SEG_KCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, 0);
8010790b:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010790e:	66 c7 40 78 ff ff    	movw   $0xffff,0x78(%eax)
80107914:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107917:	66 c7 40 7a 00 00    	movw   $0x0,0x7a(%eax)
8010791d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107920:	c6 40 7c 00          	movb   $0x0,0x7c(%eax)
80107924:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107927:	0f b6 50 7d          	movzbl 0x7d(%eax),%edx
8010792b:	83 e2 f0             	and    $0xfffffff0,%edx
8010792e:	83 ca 0a             	or     $0xa,%edx
80107931:	88 50 7d             	mov    %dl,0x7d(%eax)
80107934:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107937:	0f b6 50 7d          	movzbl 0x7d(%eax),%edx
8010793b:	83 ca 10             	or     $0x10,%edx
8010793e:	88 50 7d             	mov    %dl,0x7d(%eax)
80107941:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107944:	0f b6 50 7d          	movzbl 0x7d(%eax),%edx
80107948:	83 e2 9f             	and    $0xffffff9f,%edx
8010794b:	88 50 7d             	mov    %dl,0x7d(%eax)
8010794e:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107951:	0f b6 50 7d          	movzbl 0x7d(%eax),%edx
80107955:	83 ca 80             	or     $0xffffff80,%edx
80107958:	88 50 7d             	mov    %dl,0x7d(%eax)
8010795b:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010795e:	0f b6 50 7e          	movzbl 0x7e(%eax),%edx
80107962:	83 ca 0f             	or     $0xf,%edx
80107965:	88 50 7e             	mov    %dl,0x7e(%eax)
80107968:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010796b:	0f b6 50 7e          	movzbl 0x7e(%eax),%edx
8010796f:	83 e2 ef             	and    $0xffffffef,%edx
80107972:	88 50 7e             	mov    %dl,0x7e(%eax)
80107975:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107978:	0f b6 50 7e          	movzbl 0x7e(%eax),%edx
8010797c:	83 e2 df             	and    $0xffffffdf,%edx
8010797f:	88 50 7e             	mov    %dl,0x7e(%eax)
80107982:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107985:	0f b6 50 7e          	movzbl 0x7e(%eax),%edx
80107989:	83 ca 40             	or     $0x40,%edx
8010798c:	88 50 7e             	mov    %dl,0x7e(%eax)
8010798f:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107992:	0f b6 50 7e          	movzbl 0x7e(%eax),%edx
80107996:	83 ca 80             	or     $0xffffff80,%edx
80107999:	88 50 7e             	mov    %dl,0x7e(%eax)
8010799c:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010799f:	c6 40 7f 00          	movb   $0x0,0x7f(%eax)
  c->gdt[SEG_KDATA] = SEG(STA_W, 0, 0xffffffff, 0);
801079a3:	8b 45 f4             	mov    -0xc(%ebp),%eax
801079a6:	66 c7 80 80 00 00 00 	movw   $0xffff,0x80(%eax)
801079ad:	ff ff 
801079af:	8b 45 f4             	mov    -0xc(%ebp),%eax
801079b2:	66 c7 80 82 00 00 00 	movw   $0x0,0x82(%eax)
801079b9:	00 00 
801079bb:	8b 45 f4             	mov    -0xc(%ebp),%eax
801079be:	c6 80 84 00 00 00 00 	movb   $0x0,0x84(%eax)
801079c5:	8b 45 f4             	mov    -0xc(%ebp),%eax
801079c8:	0f b6 90 85 00 00 00 	movzbl 0x85(%eax),%edx
801079cf:	83 e2 f0             	and    $0xfffffff0,%edx
801079d2:	83 ca 02             	or     $0x2,%edx
801079d5:	88 90 85 00 00 00    	mov    %dl,0x85(%eax)
801079db:	8b 45 f4             	mov    -0xc(%ebp),%eax
801079de:	0f b6 90 85 00 00 00 	movzbl 0x85(%eax),%edx
801079e5:	83 ca 10             	or     $0x10,%edx
801079e8:	88 90 85 00 00 00    	mov    %dl,0x85(%eax)
801079ee:	8b 45 f4             	mov    -0xc(%ebp),%eax
801079f1:	0f b6 90 85 00 00 00 	movzbl 0x85(%eax),%edx
801079f8:	83 e2 9f             	and    $0xffffff9f,%edx
801079fb:	88 90 85 00 00 00    	mov    %dl,0x85(%eax)
80107a01:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107a04:	0f b6 90 85 00 00 00 	movzbl 0x85(%eax),%edx
80107a0b:	83 ca 80             	or     $0xffffff80,%edx
80107a0e:	88 90 85 00 00 00    	mov    %dl,0x85(%eax)
80107a14:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107a17:	0f b6 90 86 00 00 00 	movzbl 0x86(%eax),%edx
80107a1e:	83 ca 0f             	or     $0xf,%edx
80107a21:	88 90 86 00 00 00    	mov    %dl,0x86(%eax)
80107a27:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107a2a:	0f b6 90 86 00 00 00 	movzbl 0x86(%eax),%edx
80107a31:	83 e2 ef             	and    $0xffffffef,%edx
80107a34:	88 90 86 00 00 00    	mov    %dl,0x86(%eax)
80107a3a:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107a3d:	0f b6 90 86 00 00 00 	movzbl 0x86(%eax),%edx
80107a44:	83 e2 df             	and    $0xffffffdf,%edx
80107a47:	88 90 86 00 00 00    	mov    %dl,0x86(%eax)
80107a4d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107a50:	0f b6 90 86 00 00 00 	movzbl 0x86(%eax),%edx
80107a57:	83 ca 40             	or     $0x40,%edx
80107a5a:	88 90 86 00 00 00    	mov    %dl,0x86(%eax)
80107a60:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107a63:	0f b6 90 86 00 00 00 	movzbl 0x86(%eax),%edx
80107a6a:	83 ca 80             	or     $0xffffff80,%edx
80107a6d:	88 90 86 00 00 00    	mov    %dl,0x86(%eax)
80107a73:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107a76:	c6 80 87 00 00 00 00 	movb   $0x0,0x87(%eax)
  c->gdt[SEG_UCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, DPL_USER);
80107a7d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107a80:	66 c7 80 90 00 00 00 	movw   $0xffff,0x90(%eax)
80107a87:	ff ff 
80107a89:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107a8c:	66 c7 80 92 00 00 00 	movw   $0x0,0x92(%eax)
80107a93:	00 00 
80107a95:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107a98:	c6 80 94 00 00 00 00 	movb   $0x0,0x94(%eax)
80107a9f:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107aa2:	0f b6 90 95 00 00 00 	movzbl 0x95(%eax),%edx
80107aa9:	83 e2 f0             	and    $0xfffffff0,%edx
80107aac:	83 ca 0a             	or     $0xa,%edx
80107aaf:	88 90 95 00 00 00    	mov    %dl,0x95(%eax)
80107ab5:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107ab8:	0f b6 90 95 00 00 00 	movzbl 0x95(%eax),%edx
80107abf:	83 ca 10             	or     $0x10,%edx
80107ac2:	88 90 95 00 00 00    	mov    %dl,0x95(%eax)
80107ac8:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107acb:	0f b6 90 95 00 00 00 	movzbl 0x95(%eax),%edx
80107ad2:	83 ca 60             	or     $0x60,%edx
80107ad5:	88 90 95 00 00 00    	mov    %dl,0x95(%eax)
80107adb:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107ade:	0f b6 90 95 00 00 00 	movzbl 0x95(%eax),%edx
80107ae5:	83 ca 80             	or     $0xffffff80,%edx
80107ae8:	88 90 95 00 00 00    	mov    %dl,0x95(%eax)
80107aee:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107af1:	0f b6 90 96 00 00 00 	movzbl 0x96(%eax),%edx
80107af8:	83 ca 0f             	or     $0xf,%edx
80107afb:	88 90 96 00 00 00    	mov    %dl,0x96(%eax)
80107b01:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107b04:	0f b6 90 96 00 00 00 	movzbl 0x96(%eax),%edx
80107b0b:	83 e2 ef             	and    $0xffffffef,%edx
80107b0e:	88 90 96 00 00 00    	mov    %dl,0x96(%eax)
80107b14:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107b17:	0f b6 90 96 00 00 00 	movzbl 0x96(%eax),%edx
80107b1e:	83 e2 df             	and    $0xffffffdf,%edx
80107b21:	88 90 96 00 00 00    	mov    %dl,0x96(%eax)
80107b27:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107b2a:	0f b6 90 96 00 00 00 	movzbl 0x96(%eax),%edx
80107b31:	83 ca 40             	or     $0x40,%edx
80107b34:	88 90 96 00 00 00    	mov    %dl,0x96(%eax)
80107b3a:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107b3d:	0f b6 90 96 00 00 00 	movzbl 0x96(%eax),%edx
80107b44:	83 ca 80             	or     $0xffffff80,%edx
80107b47:	88 90 96 00 00 00    	mov    %dl,0x96(%eax)
80107b4d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107b50:	c6 80 97 00 00 00 00 	movb   $0x0,0x97(%eax)
  c->gdt[SEG_UDATA] = SEG(STA_W, 0, 0xffffffff, DPL_USER);
80107b57:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107b5a:	66 c7 80 98 00 00 00 	movw   $0xffff,0x98(%eax)
80107b61:	ff ff 
80107b63:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107b66:	66 c7 80 9a 00 00 00 	movw   $0x0,0x9a(%eax)
80107b6d:	00 00 
80107b6f:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107b72:	c6 80 9c 00 00 00 00 	movb   $0x0,0x9c(%eax)
80107b79:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107b7c:	0f b6 90 9d 00 00 00 	movzbl 0x9d(%eax),%edx
80107b83:	83 e2 f0             	and    $0xfffffff0,%edx
80107b86:	83 ca 02             	or     $0x2,%edx
80107b89:	88 90 9d 00 00 00    	mov    %dl,0x9d(%eax)
80107b8f:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107b92:	0f b6 90 9d 00 00 00 	movzbl 0x9d(%eax),%edx
80107b99:	83 ca 10             	or     $0x10,%edx
80107b9c:	88 90 9d 00 00 00    	mov    %dl,0x9d(%eax)
80107ba2:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107ba5:	0f b6 90 9d 00 00 00 	movzbl 0x9d(%eax),%edx
80107bac:	83 ca 60             	or     $0x60,%edx
80107baf:	88 90 9d 00 00 00    	mov    %dl,0x9d(%eax)
80107bb5:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107bb8:	0f b6 90 9d 00 00 00 	movzbl 0x9d(%eax),%edx
80107bbf:	83 ca 80             	or     $0xffffff80,%edx
80107bc2:	88 90 9d 00 00 00    	mov    %dl,0x9d(%eax)
80107bc8:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107bcb:	0f b6 90 9e 00 00 00 	movzbl 0x9e(%eax),%edx
80107bd2:	83 ca 0f             	or     $0xf,%edx
80107bd5:	88 90 9e 00 00 00    	mov    %dl,0x9e(%eax)
80107bdb:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107bde:	0f b6 90 9e 00 00 00 	movzbl 0x9e(%eax),%edx
80107be5:	83 e2 ef             	and    $0xffffffef,%edx
80107be8:	88 90 9e 00 00 00    	mov    %dl,0x9e(%eax)
80107bee:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107bf1:	0f b6 90 9e 00 00 00 	movzbl 0x9e(%eax),%edx
80107bf8:	83 e2 df             	and    $0xffffffdf,%edx
80107bfb:	88 90 9e 00 00 00    	mov    %dl,0x9e(%eax)
80107c01:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107c04:	0f b6 90 9e 00 00 00 	movzbl 0x9e(%eax),%edx
80107c0b:	83 ca 40             	or     $0x40,%edx
80107c0e:	88 90 9e 00 00 00    	mov    %dl,0x9e(%eax)
80107c14:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107c17:	0f b6 90 9e 00 00 00 	movzbl 0x9e(%eax),%edx
80107c1e:	83 ca 80             	or     $0xffffff80,%edx
80107c21:	88 90 9e 00 00 00    	mov    %dl,0x9e(%eax)
80107c27:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107c2a:	c6 80 9f 00 00 00 00 	movb   $0x0,0x9f(%eax)

  // Map cpu, and curproc
  c->gdt[SEG_KCPU] = SEG(STA_W, &c->cpu, 8, 0);
80107c31:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107c34:	05 b4 00 00 00       	add    $0xb4,%eax
80107c39:	89 c3                	mov    %eax,%ebx
80107c3b:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107c3e:	05 b4 00 00 00       	add    $0xb4,%eax
80107c43:	c1 e8 10             	shr    $0x10,%eax
80107c46:	89 c1                	mov    %eax,%ecx
80107c48:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107c4b:	05 b4 00 00 00       	add    $0xb4,%eax
80107c50:	c1 e8 18             	shr    $0x18,%eax
80107c53:	89 c2                	mov    %eax,%edx
80107c55:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107c58:	66 c7 80 88 00 00 00 	movw   $0x0,0x88(%eax)
80107c5f:	00 00 
80107c61:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107c64:	66 89 98 8a 00 00 00 	mov    %bx,0x8a(%eax)
80107c6b:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107c6e:	88 88 8c 00 00 00    	mov    %cl,0x8c(%eax)
80107c74:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107c77:	0f b6 88 8d 00 00 00 	movzbl 0x8d(%eax),%ecx
80107c7e:	83 e1 f0             	and    $0xfffffff0,%ecx
80107c81:	83 c9 02             	or     $0x2,%ecx
80107c84:	88 88 8d 00 00 00    	mov    %cl,0x8d(%eax)
80107c8a:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107c8d:	0f b6 88 8d 00 00 00 	movzbl 0x8d(%eax),%ecx
80107c94:	83 c9 10             	or     $0x10,%ecx
80107c97:	88 88 8d 00 00 00    	mov    %cl,0x8d(%eax)
80107c9d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107ca0:	0f b6 88 8d 00 00 00 	movzbl 0x8d(%eax),%ecx
80107ca7:	83 e1 9f             	and    $0xffffff9f,%ecx
80107caa:	88 88 8d 00 00 00    	mov    %cl,0x8d(%eax)
80107cb0:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107cb3:	0f b6 88 8d 00 00 00 	movzbl 0x8d(%eax),%ecx
80107cba:	83 c9 80             	or     $0xffffff80,%ecx
80107cbd:	88 88 8d 00 00 00    	mov    %cl,0x8d(%eax)
80107cc3:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107cc6:	0f b6 88 8e 00 00 00 	movzbl 0x8e(%eax),%ecx
80107ccd:	83 e1 f0             	and    $0xfffffff0,%ecx
80107cd0:	88 88 8e 00 00 00    	mov    %cl,0x8e(%eax)
80107cd6:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107cd9:	0f b6 88 8e 00 00 00 	movzbl 0x8e(%eax),%ecx
80107ce0:	83 e1 ef             	and    $0xffffffef,%ecx
80107ce3:	88 88 8e 00 00 00    	mov    %cl,0x8e(%eax)
80107ce9:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107cec:	0f b6 88 8e 00 00 00 	movzbl 0x8e(%eax),%ecx
80107cf3:	83 e1 df             	and    $0xffffffdf,%ecx
80107cf6:	88 88 8e 00 00 00    	mov    %cl,0x8e(%eax)
80107cfc:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107cff:	0f b6 88 8e 00 00 00 	movzbl 0x8e(%eax),%ecx
80107d06:	83 c9 40             	or     $0x40,%ecx
80107d09:	88 88 8e 00 00 00    	mov    %cl,0x8e(%eax)
80107d0f:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107d12:	0f b6 88 8e 00 00 00 	movzbl 0x8e(%eax),%ecx
80107d19:	83 c9 80             	or     $0xffffff80,%ecx
80107d1c:	88 88 8e 00 00 00    	mov    %cl,0x8e(%eax)
80107d22:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107d25:	88 90 8f 00 00 00    	mov    %dl,0x8f(%eax)

  lgdt(c->gdt, sizeof(c->gdt));
80107d2b:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107d2e:	83 c0 70             	add    $0x70,%eax
80107d31:	c7 44 24 04 38 00 00 	movl   $0x38,0x4(%esp)
80107d38:	00 
80107d39:	89 04 24             	mov    %eax,(%esp)
80107d3c:	e8 37 fb ff ff       	call   80107878 <lgdt>
  loadgs(SEG_KCPU << 3);
80107d41:	c7 04 24 18 00 00 00 	movl   $0x18,(%esp)
80107d48:	e8 6a fb ff ff       	call   801078b7 <loadgs>
  
  // Initialize cpu-local storage.
  cpu = c;
80107d4d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107d50:	65 a3 00 00 00 00    	mov    %eax,%gs:0x0
  proc = 0;
80107d56:	65 c7 05 04 00 00 00 	movl   $0x0,%gs:0x4
80107d5d:	00 00 00 00 
}
80107d61:	83 c4 24             	add    $0x24,%esp
80107d64:	5b                   	pop    %ebx
80107d65:	5d                   	pop    %ebp
80107d66:	c3                   	ret    

80107d67 <walkpgdir>:
// Return the address of the PTE in page table pgdir
// that corresponds to virtual address va.  If alloc!=0,
// create any required page table pages.
static pte_t *
walkpgdir(pde_t *pgdir, const void *va, int alloc)
{
80107d67:	55                   	push   %ebp
80107d68:	89 e5                	mov    %esp,%ebp
80107d6a:	83 ec 28             	sub    $0x28,%esp
  pde_t *pde;
  pte_t *pgtab;

  pde = &pgdir[PDX(va)];
80107d6d:	8b 45 0c             	mov    0xc(%ebp),%eax
80107d70:	c1 e8 16             	shr    $0x16,%eax
80107d73:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
80107d7a:	8b 45 08             	mov    0x8(%ebp),%eax
80107d7d:	01 d0                	add    %edx,%eax
80107d7f:	89 45 f0             	mov    %eax,-0x10(%ebp)
  if(*pde & PTE_P){
80107d82:	8b 45 f0             	mov    -0x10(%ebp),%eax
80107d85:	8b 00                	mov    (%eax),%eax
80107d87:	83 e0 01             	and    $0x1,%eax
80107d8a:	85 c0                	test   %eax,%eax
80107d8c:	74 17                	je     80107da5 <walkpgdir+0x3e>
    pgtab = (pte_t*)p2v(PTE_ADDR(*pde));
80107d8e:	8b 45 f0             	mov    -0x10(%ebp),%eax
80107d91:	8b 00                	mov    (%eax),%eax
80107d93:	25 00 f0 ff ff       	and    $0xfffff000,%eax
80107d98:	89 04 24             	mov    %eax,(%esp)
80107d9b:	e8 44 fb ff ff       	call   801078e4 <p2v>
80107da0:	89 45 f4             	mov    %eax,-0xc(%ebp)
80107da3:	eb 4b                	jmp    80107df0 <walkpgdir+0x89>
  } else {
    if(!alloc || (pgtab = (pte_t*)kalloc()) == 0)
80107da5:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
80107da9:	74 0e                	je     80107db9 <walkpgdir+0x52>
80107dab:	e8 9b ad ff ff       	call   80102b4b <kalloc>
80107db0:	89 45 f4             	mov    %eax,-0xc(%ebp)
80107db3:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
80107db7:	75 07                	jne    80107dc0 <walkpgdir+0x59>
      return 0;
80107db9:	b8 00 00 00 00       	mov    $0x0,%eax
80107dbe:	eb 47                	jmp    80107e07 <walkpgdir+0xa0>
    // Make sure all those PTE_P bits are zero.
    memset(pgtab, 0, PGSIZE);
80107dc0:	c7 44 24 08 00 10 00 	movl   $0x1000,0x8(%esp)
80107dc7:	00 
80107dc8:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
80107dcf:	00 
80107dd0:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107dd3:	89 04 24             	mov    %eax,(%esp)
80107dd6:	e8 97 d4 ff ff       	call   80105272 <memset>
    // The permissions here are overly generous, but they can
    // be further restricted by the permissions in the page table 
    // entries, if necessary.
    *pde = v2p(pgtab) | PTE_P | PTE_W | PTE_U;
80107ddb:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107dde:	89 04 24             	mov    %eax,(%esp)
80107de1:	e8 f1 fa ff ff       	call   801078d7 <v2p>
80107de6:	89 c2                	mov    %eax,%edx
80107de8:	83 ca 07             	or     $0x7,%edx
80107deb:	8b 45 f0             	mov    -0x10(%ebp),%eax
80107dee:	89 10                	mov    %edx,(%eax)
  }
  return &pgtab[PTX(va)];
80107df0:	8b 45 0c             	mov    0xc(%ebp),%eax
80107df3:	c1 e8 0c             	shr    $0xc,%eax
80107df6:	25 ff 03 00 00       	and    $0x3ff,%eax
80107dfb:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
80107e02:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107e05:	01 d0                	add    %edx,%eax
}
80107e07:	c9                   	leave  
80107e08:	c3                   	ret    

80107e09 <mappages>:
// Create PTEs for virtual addresses starting at va that refer to
// physical addresses starting at pa. va and size might not
// be page-aligned.
static int
mappages(pde_t *pgdir, void *va, uint size, uint pa, int perm)
{
80107e09:	55                   	push   %ebp
80107e0a:	89 e5                	mov    %esp,%ebp
80107e0c:	83 ec 28             	sub    $0x28,%esp
  char *a, *last;
  pte_t *pte;
  
  a = (char*)PGROUNDDOWN((uint)va);
80107e0f:	8b 45 0c             	mov    0xc(%ebp),%eax
80107e12:	25 00 f0 ff ff       	and    $0xfffff000,%eax
80107e17:	89 45 f4             	mov    %eax,-0xc(%ebp)
  last = (char*)PGROUNDDOWN(((uint)va) + size - 1);
80107e1a:	8b 55 0c             	mov    0xc(%ebp),%edx
80107e1d:	8b 45 10             	mov    0x10(%ebp),%eax
80107e20:	01 d0                	add    %edx,%eax
80107e22:	83 e8 01             	sub    $0x1,%eax
80107e25:	25 00 f0 ff ff       	and    $0xfffff000,%eax
80107e2a:	89 45 f0             	mov    %eax,-0x10(%ebp)
  for(;;){
    if((pte = walkpgdir(pgdir, a, 1)) == 0)
80107e2d:	c7 44 24 08 01 00 00 	movl   $0x1,0x8(%esp)
80107e34:	00 
80107e35:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107e38:	89 44 24 04          	mov    %eax,0x4(%esp)
80107e3c:	8b 45 08             	mov    0x8(%ebp),%eax
80107e3f:	89 04 24             	mov    %eax,(%esp)
80107e42:	e8 20 ff ff ff       	call   80107d67 <walkpgdir>
80107e47:	89 45 ec             	mov    %eax,-0x14(%ebp)
80107e4a:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
80107e4e:	75 07                	jne    80107e57 <mappages+0x4e>
      return -1;
80107e50:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80107e55:	eb 46                	jmp    80107e9d <mappages+0x94>
    if(*pte & PTE_P)
80107e57:	8b 45 ec             	mov    -0x14(%ebp),%eax
80107e5a:	8b 00                	mov    (%eax),%eax
80107e5c:	83 e0 01             	and    $0x1,%eax
80107e5f:	85 c0                	test   %eax,%eax
80107e61:	74 0c                	je     80107e6f <mappages+0x66>
      panic("remap");
80107e63:	c7 04 24 b4 8c 10 80 	movl   $0x80108cb4,(%esp)
80107e6a:	e8 d7 86 ff ff       	call   80100546 <panic>
    *pte = pa | perm | PTE_P;
80107e6f:	8b 45 18             	mov    0x18(%ebp),%eax
80107e72:	0b 45 14             	or     0x14(%ebp),%eax
80107e75:	89 c2                	mov    %eax,%edx
80107e77:	83 ca 01             	or     $0x1,%edx
80107e7a:	8b 45 ec             	mov    -0x14(%ebp),%eax
80107e7d:	89 10                	mov    %edx,(%eax)
    if(a == last)
80107e7f:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107e82:	3b 45 f0             	cmp    -0x10(%ebp),%eax
80107e85:	74 10                	je     80107e97 <mappages+0x8e>
      break;
    a += PGSIZE;
80107e87:	81 45 f4 00 10 00 00 	addl   $0x1000,-0xc(%ebp)
    pa += PGSIZE;
80107e8e:	81 45 14 00 10 00 00 	addl   $0x1000,0x14(%ebp)
  }
80107e95:	eb 96                	jmp    80107e2d <mappages+0x24>
      return -1;
    if(*pte & PTE_P)
      panic("remap");
    *pte = pa | perm | PTE_P;
    if(a == last)
      break;
80107e97:	90                   	nop
    a += PGSIZE;
    pa += PGSIZE;
  }
  return 0;
80107e98:	b8 00 00 00 00       	mov    $0x0,%eax
}
80107e9d:	c9                   	leave  
80107e9e:	c3                   	ret    

80107e9f <setupkvm>:
};

// Set up kernel part of a page table.
pde_t*
setupkvm()
{
80107e9f:	55                   	push   %ebp
80107ea0:	89 e5                	mov    %esp,%ebp
80107ea2:	53                   	push   %ebx
80107ea3:	83 ec 34             	sub    $0x34,%esp
  pde_t *pgdir;
  struct kmap *k;

  if((pgdir = (pde_t*)kalloc()) == 0)
80107ea6:	e8 a0 ac ff ff       	call   80102b4b <kalloc>
80107eab:	89 45 f0             	mov    %eax,-0x10(%ebp)
80107eae:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
80107eb2:	75 0a                	jne    80107ebe <setupkvm+0x1f>
    return 0;
80107eb4:	b8 00 00 00 00       	mov    $0x0,%eax
80107eb9:	e9 98 00 00 00       	jmp    80107f56 <setupkvm+0xb7>
  memset(pgdir, 0, PGSIZE);
80107ebe:	c7 44 24 08 00 10 00 	movl   $0x1000,0x8(%esp)
80107ec5:	00 
80107ec6:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
80107ecd:	00 
80107ece:	8b 45 f0             	mov    -0x10(%ebp),%eax
80107ed1:	89 04 24             	mov    %eax,(%esp)
80107ed4:	e8 99 d3 ff ff       	call   80105272 <memset>
  if (p2v(PHYSTOP) > (void*)DEVSPACE)
80107ed9:	c7 04 24 00 00 00 0e 	movl   $0xe000000,(%esp)
80107ee0:	e8 ff f9 ff ff       	call   801078e4 <p2v>
80107ee5:	3d 00 00 00 fe       	cmp    $0xfe000000,%eax
80107eea:	76 0c                	jbe    80107ef8 <setupkvm+0x59>
    panic("PHYSTOP too high");
80107eec:	c7 04 24 ba 8c 10 80 	movl   $0x80108cba,(%esp)
80107ef3:	e8 4e 86 ff ff       	call   80100546 <panic>
  for(k = kmap; k < &kmap[NELEM(kmap)]; k++)
80107ef8:	c7 45 f4 e0 b4 10 80 	movl   $0x8010b4e0,-0xc(%ebp)
80107eff:	eb 49                	jmp    80107f4a <setupkvm+0xab>
    if(mappages(pgdir, k->virt, k->phys_end - k->phys_start, 
                (uint)k->phys_start, k->perm) < 0)
80107f01:	8b 45 f4             	mov    -0xc(%ebp),%eax
    return 0;
  memset(pgdir, 0, PGSIZE);
  if (p2v(PHYSTOP) > (void*)DEVSPACE)
    panic("PHYSTOP too high");
  for(k = kmap; k < &kmap[NELEM(kmap)]; k++)
    if(mappages(pgdir, k->virt, k->phys_end - k->phys_start, 
80107f04:	8b 48 0c             	mov    0xc(%eax),%ecx
                (uint)k->phys_start, k->perm) < 0)
80107f07:	8b 45 f4             	mov    -0xc(%ebp),%eax
    return 0;
  memset(pgdir, 0, PGSIZE);
  if (p2v(PHYSTOP) > (void*)DEVSPACE)
    panic("PHYSTOP too high");
  for(k = kmap; k < &kmap[NELEM(kmap)]; k++)
    if(mappages(pgdir, k->virt, k->phys_end - k->phys_start, 
80107f0a:	8b 50 04             	mov    0x4(%eax),%edx
80107f0d:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107f10:	8b 58 08             	mov    0x8(%eax),%ebx
80107f13:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107f16:	8b 40 04             	mov    0x4(%eax),%eax
80107f19:	29 c3                	sub    %eax,%ebx
80107f1b:	8b 45 f4             	mov    -0xc(%ebp),%eax
80107f1e:	8b 00                	mov    (%eax),%eax
80107f20:	89 4c 24 10          	mov    %ecx,0x10(%esp)
80107f24:	89 54 24 0c          	mov    %edx,0xc(%esp)
80107f28:	89 5c 24 08          	mov    %ebx,0x8(%esp)
80107f2c:	89 44 24 04          	mov    %eax,0x4(%esp)
80107f30:	8b 45 f0             	mov    -0x10(%ebp),%eax
80107f33:	89 04 24             	mov    %eax,(%esp)
80107f36:	e8 ce fe ff ff       	call   80107e09 <mappages>
80107f3b:	85 c0                	test   %eax,%eax
80107f3d:	79 07                	jns    80107f46 <setupkvm+0xa7>
                (uint)k->phys_start, k->perm) < 0)
      return 0;
80107f3f:	b8 00 00 00 00       	mov    $0x0,%eax
80107f44:	eb 10                	jmp    80107f56 <setupkvm+0xb7>
  if((pgdir = (pde_t*)kalloc()) == 0)
    return 0;
  memset(pgdir, 0, PGSIZE);
  if (p2v(PHYSTOP) > (void*)DEVSPACE)
    panic("PHYSTOP too high");
  for(k = kmap; k < &kmap[NELEM(kmap)]; k++)
80107f46:	83 45 f4 10          	addl   $0x10,-0xc(%ebp)
80107f4a:	81 7d f4 20 b5 10 80 	cmpl   $0x8010b520,-0xc(%ebp)
80107f51:	72 ae                	jb     80107f01 <setupkvm+0x62>
    if(mappages(pgdir, k->virt, k->phys_end - k->phys_start, 
                (uint)k->phys_start, k->perm) < 0)
      return 0;
  return pgdir;
80107f53:	8b 45 f0             	mov    -0x10(%ebp),%eax
}
80107f56:	83 c4 34             	add    $0x34,%esp
80107f59:	5b                   	pop    %ebx
80107f5a:	5d                   	pop    %ebp
80107f5b:	c3                   	ret    

80107f5c <kvmalloc>:

// Allocate one page table for the machine for the kernel address
// space for scheduler processes.
void
kvmalloc(void)
{
80107f5c:	55                   	push   %ebp
80107f5d:	89 e5                	mov    %esp,%ebp
80107f5f:	83 ec 08             	sub    $0x8,%esp
  kpgdir = setupkvm();
80107f62:	e8 38 ff ff ff       	call   80107e9f <setupkvm>
80107f67:	a3 38 49 11 80       	mov    %eax,0x80114938
  switchkvm();
80107f6c:	e8 02 00 00 00       	call   80107f73 <switchkvm>
}
80107f71:	c9                   	leave  
80107f72:	c3                   	ret    

80107f73 <switchkvm>:

// Switch h/w page table register to the kernel-only page table,
// for when no process is running.
void
switchkvm(void)
{
80107f73:	55                   	push   %ebp
80107f74:	89 e5                	mov    %esp,%ebp
80107f76:	83 ec 04             	sub    $0x4,%esp
  lcr3(v2p(kpgdir));   // switch to the kernel page table
80107f79:	a1 38 49 11 80       	mov    0x80114938,%eax
80107f7e:	89 04 24             	mov    %eax,(%esp)
80107f81:	e8 51 f9 ff ff       	call   801078d7 <v2p>
80107f86:	89 04 24             	mov    %eax,(%esp)
80107f89:	e8 3e f9 ff ff       	call   801078cc <lcr3>
}
80107f8e:	c9                   	leave  
80107f8f:	c3                   	ret    

80107f90 <switchuvm>:

// Switch TSS and h/w page table to correspond to process p.
void
switchuvm(struct proc *p)
{
80107f90:	55                   	push   %ebp
80107f91:	89 e5                	mov    %esp,%ebp
80107f93:	53                   	push   %ebx
80107f94:	83 ec 14             	sub    $0x14,%esp
  pushcli();
80107f97:	e8 cf d1 ff ff       	call   8010516b <pushcli>
  cpu->gdt[SEG_TSS] = SEG16(STS_T32A, &cpu->ts, sizeof(cpu->ts)-1, 0);
80107f9c:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
80107fa2:	65 8b 15 00 00 00 00 	mov    %gs:0x0,%edx
80107fa9:	83 c2 08             	add    $0x8,%edx
80107fac:	89 d3                	mov    %edx,%ebx
80107fae:	65 8b 15 00 00 00 00 	mov    %gs:0x0,%edx
80107fb5:	83 c2 08             	add    $0x8,%edx
80107fb8:	c1 ea 10             	shr    $0x10,%edx
80107fbb:	89 d1                	mov    %edx,%ecx
80107fbd:	65 8b 15 00 00 00 00 	mov    %gs:0x0,%edx
80107fc4:	83 c2 08             	add    $0x8,%edx
80107fc7:	c1 ea 18             	shr    $0x18,%edx
80107fca:	66 c7 80 a0 00 00 00 	movw   $0x67,0xa0(%eax)
80107fd1:	67 00 
80107fd3:	66 89 98 a2 00 00 00 	mov    %bx,0xa2(%eax)
80107fda:	88 88 a4 00 00 00    	mov    %cl,0xa4(%eax)
80107fe0:	0f b6 88 a5 00 00 00 	movzbl 0xa5(%eax),%ecx
80107fe7:	83 e1 f0             	and    $0xfffffff0,%ecx
80107fea:	83 c9 09             	or     $0x9,%ecx
80107fed:	88 88 a5 00 00 00    	mov    %cl,0xa5(%eax)
80107ff3:	0f b6 88 a5 00 00 00 	movzbl 0xa5(%eax),%ecx
80107ffa:	83 c9 10             	or     $0x10,%ecx
80107ffd:	88 88 a5 00 00 00    	mov    %cl,0xa5(%eax)
80108003:	0f b6 88 a5 00 00 00 	movzbl 0xa5(%eax),%ecx
8010800a:	83 e1 9f             	and    $0xffffff9f,%ecx
8010800d:	88 88 a5 00 00 00    	mov    %cl,0xa5(%eax)
80108013:	0f b6 88 a5 00 00 00 	movzbl 0xa5(%eax),%ecx
8010801a:	83 c9 80             	or     $0xffffff80,%ecx
8010801d:	88 88 a5 00 00 00    	mov    %cl,0xa5(%eax)
80108023:	0f b6 88 a6 00 00 00 	movzbl 0xa6(%eax),%ecx
8010802a:	83 e1 f0             	and    $0xfffffff0,%ecx
8010802d:	88 88 a6 00 00 00    	mov    %cl,0xa6(%eax)
80108033:	0f b6 88 a6 00 00 00 	movzbl 0xa6(%eax),%ecx
8010803a:	83 e1 ef             	and    $0xffffffef,%ecx
8010803d:	88 88 a6 00 00 00    	mov    %cl,0xa6(%eax)
80108043:	0f b6 88 a6 00 00 00 	movzbl 0xa6(%eax),%ecx
8010804a:	83 e1 df             	and    $0xffffffdf,%ecx
8010804d:	88 88 a6 00 00 00    	mov    %cl,0xa6(%eax)
80108053:	0f b6 88 a6 00 00 00 	movzbl 0xa6(%eax),%ecx
8010805a:	83 c9 40             	or     $0x40,%ecx
8010805d:	88 88 a6 00 00 00    	mov    %cl,0xa6(%eax)
80108063:	0f b6 88 a6 00 00 00 	movzbl 0xa6(%eax),%ecx
8010806a:	83 e1 7f             	and    $0x7f,%ecx
8010806d:	88 88 a6 00 00 00    	mov    %cl,0xa6(%eax)
80108073:	88 90 a7 00 00 00    	mov    %dl,0xa7(%eax)
  cpu->gdt[SEG_TSS].s = 0;
80108079:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
8010807f:	0f b6 90 a5 00 00 00 	movzbl 0xa5(%eax),%edx
80108086:	83 e2 ef             	and    $0xffffffef,%edx
80108089:	88 90 a5 00 00 00    	mov    %dl,0xa5(%eax)
  cpu->ts.ss0 = SEG_KDATA << 3;
8010808f:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
80108095:	66 c7 40 10 10 00    	movw   $0x10,0x10(%eax)
  cpu->ts.esp0 = (uint)proc->kstack + KSTACKSIZE;
8010809b:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
801080a1:	65 8b 15 04 00 00 00 	mov    %gs:0x4,%edx
801080a8:	8b 52 08             	mov    0x8(%edx),%edx
801080ab:	81 c2 00 10 00 00    	add    $0x1000,%edx
801080b1:	89 50 0c             	mov    %edx,0xc(%eax)
  ltr(SEG_TSS << 3);
801080b4:	c7 04 24 30 00 00 00 	movl   $0x30,(%esp)
801080bb:	e8 e1 f7 ff ff       	call   801078a1 <ltr>
  if(p->pgdir == 0)
801080c0:	8b 45 08             	mov    0x8(%ebp),%eax
801080c3:	8b 40 04             	mov    0x4(%eax),%eax
801080c6:	85 c0                	test   %eax,%eax
801080c8:	75 0c                	jne    801080d6 <switchuvm+0x146>
    panic("switchuvm: no pgdir");
801080ca:	c7 04 24 cb 8c 10 80 	movl   $0x80108ccb,(%esp)
801080d1:	e8 70 84 ff ff       	call   80100546 <panic>
  lcr3(v2p(p->pgdir));  // switch to new address space
801080d6:	8b 45 08             	mov    0x8(%ebp),%eax
801080d9:	8b 40 04             	mov    0x4(%eax),%eax
801080dc:	89 04 24             	mov    %eax,(%esp)
801080df:	e8 f3 f7 ff ff       	call   801078d7 <v2p>
801080e4:	89 04 24             	mov    %eax,(%esp)
801080e7:	e8 e0 f7 ff ff       	call   801078cc <lcr3>
  popcli();
801080ec:	e8 c2 d0 ff ff       	call   801051b3 <popcli>
}
801080f1:	83 c4 14             	add    $0x14,%esp
801080f4:	5b                   	pop    %ebx
801080f5:	5d                   	pop    %ebp
801080f6:	c3                   	ret    

801080f7 <inituvm>:

// Load the initcode into address 0 of pgdir.
// sz must be less than a page.
void
inituvm(pde_t *pgdir, char *init, uint sz)
{
801080f7:	55                   	push   %ebp
801080f8:	89 e5                	mov    %esp,%ebp
801080fa:	83 ec 38             	sub    $0x38,%esp
  char *mem;
  
  if(sz >= PGSIZE)
801080fd:	81 7d 10 ff 0f 00 00 	cmpl   $0xfff,0x10(%ebp)
80108104:	76 0c                	jbe    80108112 <inituvm+0x1b>
    panic("inituvm: more than a page");
80108106:	c7 04 24 df 8c 10 80 	movl   $0x80108cdf,(%esp)
8010810d:	e8 34 84 ff ff       	call   80100546 <panic>
  mem = kalloc();
80108112:	e8 34 aa ff ff       	call   80102b4b <kalloc>
80108117:	89 45 f4             	mov    %eax,-0xc(%ebp)
  memset(mem, 0, PGSIZE);
8010811a:	c7 44 24 08 00 10 00 	movl   $0x1000,0x8(%esp)
80108121:	00 
80108122:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
80108129:	00 
8010812a:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010812d:	89 04 24             	mov    %eax,(%esp)
80108130:	e8 3d d1 ff ff       	call   80105272 <memset>
  mappages(pgdir, 0, PGSIZE, v2p(mem), PTE_W|PTE_U);
80108135:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108138:	89 04 24             	mov    %eax,(%esp)
8010813b:	e8 97 f7 ff ff       	call   801078d7 <v2p>
80108140:	c7 44 24 10 06 00 00 	movl   $0x6,0x10(%esp)
80108147:	00 
80108148:	89 44 24 0c          	mov    %eax,0xc(%esp)
8010814c:	c7 44 24 08 00 10 00 	movl   $0x1000,0x8(%esp)
80108153:	00 
80108154:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
8010815b:	00 
8010815c:	8b 45 08             	mov    0x8(%ebp),%eax
8010815f:	89 04 24             	mov    %eax,(%esp)
80108162:	e8 a2 fc ff ff       	call   80107e09 <mappages>
  memmove(mem, init, sz);
80108167:	8b 45 10             	mov    0x10(%ebp),%eax
8010816a:	89 44 24 08          	mov    %eax,0x8(%esp)
8010816e:	8b 45 0c             	mov    0xc(%ebp),%eax
80108171:	89 44 24 04          	mov    %eax,0x4(%esp)
80108175:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108178:	89 04 24             	mov    %eax,(%esp)
8010817b:	e8 c5 d1 ff ff       	call   80105345 <memmove>
}
80108180:	c9                   	leave  
80108181:	c3                   	ret    

80108182 <loaduvm>:

// Load a program segment into pgdir.  addr must be page-aligned
// and the pages from addr to addr+sz must already be mapped.
int
loaduvm(pde_t *pgdir, char *addr, struct inode *ip, uint offset, uint sz)
{
80108182:	55                   	push   %ebp
80108183:	89 e5                	mov    %esp,%ebp
80108185:	53                   	push   %ebx
80108186:	83 ec 24             	sub    $0x24,%esp
  uint i, pa, n;
  pte_t *pte;

  if((uint) addr % PGSIZE != 0)
80108189:	8b 45 0c             	mov    0xc(%ebp),%eax
8010818c:	25 ff 0f 00 00       	and    $0xfff,%eax
80108191:	85 c0                	test   %eax,%eax
80108193:	74 0c                	je     801081a1 <loaduvm+0x1f>
    panic("loaduvm: addr must be page aligned");
80108195:	c7 04 24 fc 8c 10 80 	movl   $0x80108cfc,(%esp)
8010819c:	e8 a5 83 ff ff       	call   80100546 <panic>
  for(i = 0; i < sz; i += PGSIZE){
801081a1:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
801081a8:	e9 ad 00 00 00       	jmp    8010825a <loaduvm+0xd8>
    if((pte = walkpgdir(pgdir, addr+i, 0)) == 0)
801081ad:	8b 45 f4             	mov    -0xc(%ebp),%eax
801081b0:	8b 55 0c             	mov    0xc(%ebp),%edx
801081b3:	01 d0                	add    %edx,%eax
801081b5:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
801081bc:	00 
801081bd:	89 44 24 04          	mov    %eax,0x4(%esp)
801081c1:	8b 45 08             	mov    0x8(%ebp),%eax
801081c4:	89 04 24             	mov    %eax,(%esp)
801081c7:	e8 9b fb ff ff       	call   80107d67 <walkpgdir>
801081cc:	89 45 ec             	mov    %eax,-0x14(%ebp)
801081cf:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
801081d3:	75 0c                	jne    801081e1 <loaduvm+0x5f>
      panic("loaduvm: address should exist");
801081d5:	c7 04 24 1f 8d 10 80 	movl   $0x80108d1f,(%esp)
801081dc:	e8 65 83 ff ff       	call   80100546 <panic>
    pa = PTE_ADDR(*pte);
801081e1:	8b 45 ec             	mov    -0x14(%ebp),%eax
801081e4:	8b 00                	mov    (%eax),%eax
801081e6:	25 00 f0 ff ff       	and    $0xfffff000,%eax
801081eb:	89 45 e8             	mov    %eax,-0x18(%ebp)
    if(sz - i < PGSIZE)
801081ee:	8b 45 f4             	mov    -0xc(%ebp),%eax
801081f1:	8b 55 18             	mov    0x18(%ebp),%edx
801081f4:	89 d1                	mov    %edx,%ecx
801081f6:	29 c1                	sub    %eax,%ecx
801081f8:	89 c8                	mov    %ecx,%eax
801081fa:	3d ff 0f 00 00       	cmp    $0xfff,%eax
801081ff:	77 11                	ja     80108212 <loaduvm+0x90>
      n = sz - i;
80108201:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108204:	8b 55 18             	mov    0x18(%ebp),%edx
80108207:	89 d1                	mov    %edx,%ecx
80108209:	29 c1                	sub    %eax,%ecx
8010820b:	89 c8                	mov    %ecx,%eax
8010820d:	89 45 f0             	mov    %eax,-0x10(%ebp)
80108210:	eb 07                	jmp    80108219 <loaduvm+0x97>
    else
      n = PGSIZE;
80108212:	c7 45 f0 00 10 00 00 	movl   $0x1000,-0x10(%ebp)
    if(readi(ip, p2v(pa), offset+i, n) != n)
80108219:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010821c:	8b 55 14             	mov    0x14(%ebp),%edx
8010821f:	8d 1c 02             	lea    (%edx,%eax,1),%ebx
80108222:	8b 45 e8             	mov    -0x18(%ebp),%eax
80108225:	89 04 24             	mov    %eax,(%esp)
80108228:	e8 b7 f6 ff ff       	call   801078e4 <p2v>
8010822d:	8b 55 f0             	mov    -0x10(%ebp),%edx
80108230:	89 54 24 0c          	mov    %edx,0xc(%esp)
80108234:	89 5c 24 08          	mov    %ebx,0x8(%esp)
80108238:	89 44 24 04          	mov    %eax,0x4(%esp)
8010823c:	8b 45 10             	mov    0x10(%ebp),%eax
8010823f:	89 04 24             	mov    %eax,(%esp)
80108242:	e8 5a 9b ff ff       	call   80101da1 <readi>
80108247:	3b 45 f0             	cmp    -0x10(%ebp),%eax
8010824a:	74 07                	je     80108253 <loaduvm+0xd1>
      return -1;
8010824c:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80108251:	eb 18                	jmp    8010826b <loaduvm+0xe9>
  uint i, pa, n;
  pte_t *pte;

  if((uint) addr % PGSIZE != 0)
    panic("loaduvm: addr must be page aligned");
  for(i = 0; i < sz; i += PGSIZE){
80108253:	81 45 f4 00 10 00 00 	addl   $0x1000,-0xc(%ebp)
8010825a:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010825d:	3b 45 18             	cmp    0x18(%ebp),%eax
80108260:	0f 82 47 ff ff ff    	jb     801081ad <loaduvm+0x2b>
    else
      n = PGSIZE;
    if(readi(ip, p2v(pa), offset+i, n) != n)
      return -1;
  }
  return 0;
80108266:	b8 00 00 00 00       	mov    $0x0,%eax
}
8010826b:	83 c4 24             	add    $0x24,%esp
8010826e:	5b                   	pop    %ebx
8010826f:	5d                   	pop    %ebp
80108270:	c3                   	ret    

80108271 <allocuvm>:

// Allocate page tables and physical memory to grow process from oldsz to
// newsz, which need not be page aligned.  Returns new size or 0 on error.
int
allocuvm(pde_t *pgdir, uint oldsz, uint newsz)
{
80108271:	55                   	push   %ebp
80108272:	89 e5                	mov    %esp,%ebp
80108274:	83 ec 38             	sub    $0x38,%esp
  char *mem;
  uint a;

  if(newsz >= KERNBASE)
80108277:	8b 45 10             	mov    0x10(%ebp),%eax
8010827a:	85 c0                	test   %eax,%eax
8010827c:	79 0a                	jns    80108288 <allocuvm+0x17>
    return 0;
8010827e:	b8 00 00 00 00       	mov    $0x0,%eax
80108283:	e9 c1 00 00 00       	jmp    80108349 <allocuvm+0xd8>
  if(newsz < oldsz)
80108288:	8b 45 10             	mov    0x10(%ebp),%eax
8010828b:	3b 45 0c             	cmp    0xc(%ebp),%eax
8010828e:	73 08                	jae    80108298 <allocuvm+0x27>
    return oldsz;
80108290:	8b 45 0c             	mov    0xc(%ebp),%eax
80108293:	e9 b1 00 00 00       	jmp    80108349 <allocuvm+0xd8>

  a = PGROUNDUP(oldsz);
80108298:	8b 45 0c             	mov    0xc(%ebp),%eax
8010829b:	05 ff 0f 00 00       	add    $0xfff,%eax
801082a0:	25 00 f0 ff ff       	and    $0xfffff000,%eax
801082a5:	89 45 f4             	mov    %eax,-0xc(%ebp)
  for(; a < newsz; a += PGSIZE){
801082a8:	e9 8d 00 00 00       	jmp    8010833a <allocuvm+0xc9>
    mem = kalloc();
801082ad:	e8 99 a8 ff ff       	call   80102b4b <kalloc>
801082b2:	89 45 f0             	mov    %eax,-0x10(%ebp)
    if(mem == 0){
801082b5:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
801082b9:	75 2c                	jne    801082e7 <allocuvm+0x76>
      cprintf("allocuvm out of memory\n");
801082bb:	c7 04 24 3d 8d 10 80 	movl   $0x80108d3d,(%esp)
801082c2:	e8 e3 80 ff ff       	call   801003aa <cprintf>
      deallocuvm(pgdir, newsz, oldsz);
801082c7:	8b 45 0c             	mov    0xc(%ebp),%eax
801082ca:	89 44 24 08          	mov    %eax,0x8(%esp)
801082ce:	8b 45 10             	mov    0x10(%ebp),%eax
801082d1:	89 44 24 04          	mov    %eax,0x4(%esp)
801082d5:	8b 45 08             	mov    0x8(%ebp),%eax
801082d8:	89 04 24             	mov    %eax,(%esp)
801082db:	e8 6b 00 00 00       	call   8010834b <deallocuvm>
      return 0;
801082e0:	b8 00 00 00 00       	mov    $0x0,%eax
801082e5:	eb 62                	jmp    80108349 <allocuvm+0xd8>
    }
    memset(mem, 0, PGSIZE);
801082e7:	c7 44 24 08 00 10 00 	movl   $0x1000,0x8(%esp)
801082ee:	00 
801082ef:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
801082f6:	00 
801082f7:	8b 45 f0             	mov    -0x10(%ebp),%eax
801082fa:	89 04 24             	mov    %eax,(%esp)
801082fd:	e8 70 cf ff ff       	call   80105272 <memset>
    mappages(pgdir, (char*)a, PGSIZE, v2p(mem), PTE_W|PTE_U);
80108302:	8b 45 f0             	mov    -0x10(%ebp),%eax
80108305:	89 04 24             	mov    %eax,(%esp)
80108308:	e8 ca f5 ff ff       	call   801078d7 <v2p>
8010830d:	8b 55 f4             	mov    -0xc(%ebp),%edx
80108310:	c7 44 24 10 06 00 00 	movl   $0x6,0x10(%esp)
80108317:	00 
80108318:	89 44 24 0c          	mov    %eax,0xc(%esp)
8010831c:	c7 44 24 08 00 10 00 	movl   $0x1000,0x8(%esp)
80108323:	00 
80108324:	89 54 24 04          	mov    %edx,0x4(%esp)
80108328:	8b 45 08             	mov    0x8(%ebp),%eax
8010832b:	89 04 24             	mov    %eax,(%esp)
8010832e:	e8 d6 fa ff ff       	call   80107e09 <mappages>
    return 0;
  if(newsz < oldsz)
    return oldsz;

  a = PGROUNDUP(oldsz);
  for(; a < newsz; a += PGSIZE){
80108333:	81 45 f4 00 10 00 00 	addl   $0x1000,-0xc(%ebp)
8010833a:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010833d:	3b 45 10             	cmp    0x10(%ebp),%eax
80108340:	0f 82 67 ff ff ff    	jb     801082ad <allocuvm+0x3c>
      return 0;
    }
    memset(mem, 0, PGSIZE);
    mappages(pgdir, (char*)a, PGSIZE, v2p(mem), PTE_W|PTE_U);
  }
  return newsz;
80108346:	8b 45 10             	mov    0x10(%ebp),%eax
}
80108349:	c9                   	leave  
8010834a:	c3                   	ret    

8010834b <deallocuvm>:
// newsz.  oldsz and newsz need not be page-aligned, nor does newsz
// need to be less than oldsz.  oldsz can be larger than the actual
// process size.  Returns the new process size.
int
deallocuvm(pde_t *pgdir, uint oldsz, uint newsz)
{
8010834b:	55                   	push   %ebp
8010834c:	89 e5                	mov    %esp,%ebp
8010834e:	83 ec 28             	sub    $0x28,%esp
  pte_t *pte;
  uint a, pa;

  if(newsz >= oldsz)
80108351:	8b 45 10             	mov    0x10(%ebp),%eax
80108354:	3b 45 0c             	cmp    0xc(%ebp),%eax
80108357:	72 08                	jb     80108361 <deallocuvm+0x16>
    return oldsz;
80108359:	8b 45 0c             	mov    0xc(%ebp),%eax
8010835c:	e9 a4 00 00 00       	jmp    80108405 <deallocuvm+0xba>

  a = PGROUNDUP(newsz);
80108361:	8b 45 10             	mov    0x10(%ebp),%eax
80108364:	05 ff 0f 00 00       	add    $0xfff,%eax
80108369:	25 00 f0 ff ff       	and    $0xfffff000,%eax
8010836e:	89 45 f4             	mov    %eax,-0xc(%ebp)
  for(; a  < oldsz; a += PGSIZE){
80108371:	e9 80 00 00 00       	jmp    801083f6 <deallocuvm+0xab>
    pte = walkpgdir(pgdir, (char*)a, 0);
80108376:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108379:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
80108380:	00 
80108381:	89 44 24 04          	mov    %eax,0x4(%esp)
80108385:	8b 45 08             	mov    0x8(%ebp),%eax
80108388:	89 04 24             	mov    %eax,(%esp)
8010838b:	e8 d7 f9 ff ff       	call   80107d67 <walkpgdir>
80108390:	89 45 f0             	mov    %eax,-0x10(%ebp)
    if(!pte)
80108393:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
80108397:	75 09                	jne    801083a2 <deallocuvm+0x57>
      a += (NPTENTRIES - 1) * PGSIZE;
80108399:	81 45 f4 00 f0 3f 00 	addl   $0x3ff000,-0xc(%ebp)
801083a0:	eb 4d                	jmp    801083ef <deallocuvm+0xa4>
    else if((*pte & PTE_P) != 0){
801083a2:	8b 45 f0             	mov    -0x10(%ebp),%eax
801083a5:	8b 00                	mov    (%eax),%eax
801083a7:	83 e0 01             	and    $0x1,%eax
801083aa:	85 c0                	test   %eax,%eax
801083ac:	74 41                	je     801083ef <deallocuvm+0xa4>
      pa = PTE_ADDR(*pte);
801083ae:	8b 45 f0             	mov    -0x10(%ebp),%eax
801083b1:	8b 00                	mov    (%eax),%eax
801083b3:	25 00 f0 ff ff       	and    $0xfffff000,%eax
801083b8:	89 45 ec             	mov    %eax,-0x14(%ebp)
      if(pa == 0)
801083bb:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
801083bf:	75 0c                	jne    801083cd <deallocuvm+0x82>
        panic("kfree");
801083c1:	c7 04 24 55 8d 10 80 	movl   $0x80108d55,(%esp)
801083c8:	e8 79 81 ff ff       	call   80100546 <panic>
      char *v = p2v(pa);
801083cd:	8b 45 ec             	mov    -0x14(%ebp),%eax
801083d0:	89 04 24             	mov    %eax,(%esp)
801083d3:	e8 0c f5 ff ff       	call   801078e4 <p2v>
801083d8:	89 45 e8             	mov    %eax,-0x18(%ebp)
      kfree(v);
801083db:	8b 45 e8             	mov    -0x18(%ebp),%eax
801083de:	89 04 24             	mov    %eax,(%esp)
801083e1:	e8 cc a6 ff ff       	call   80102ab2 <kfree>
      *pte = 0;
801083e6:	8b 45 f0             	mov    -0x10(%ebp),%eax
801083e9:	c7 00 00 00 00 00    	movl   $0x0,(%eax)

  if(newsz >= oldsz)
    return oldsz;

  a = PGROUNDUP(newsz);
  for(; a  < oldsz; a += PGSIZE){
801083ef:	81 45 f4 00 10 00 00 	addl   $0x1000,-0xc(%ebp)
801083f6:	8b 45 f4             	mov    -0xc(%ebp),%eax
801083f9:	3b 45 0c             	cmp    0xc(%ebp),%eax
801083fc:	0f 82 74 ff ff ff    	jb     80108376 <deallocuvm+0x2b>
      char *v = p2v(pa);
      kfree(v);
      *pte = 0;
    }
  }
  return newsz;
80108402:	8b 45 10             	mov    0x10(%ebp),%eax
}
80108405:	c9                   	leave  
80108406:	c3                   	ret    

80108407 <freevm>:

// Free a page table and all the physical memory pages
// in the user part.
void
freevm(pde_t *pgdir)
{
80108407:	55                   	push   %ebp
80108408:	89 e5                	mov    %esp,%ebp
8010840a:	83 ec 28             	sub    $0x28,%esp
  uint i;

  if(pgdir == 0)
8010840d:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
80108411:	75 0c                	jne    8010841f <freevm+0x18>
    panic("freevm: no pgdir");
80108413:	c7 04 24 5b 8d 10 80 	movl   $0x80108d5b,(%esp)
8010841a:	e8 27 81 ff ff       	call   80100546 <panic>
  deallocuvm(pgdir, KERNBASE, 0);
8010841f:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
80108426:	00 
80108427:	c7 44 24 04 00 00 00 	movl   $0x80000000,0x4(%esp)
8010842e:	80 
8010842f:	8b 45 08             	mov    0x8(%ebp),%eax
80108432:	89 04 24             	mov    %eax,(%esp)
80108435:	e8 11 ff ff ff       	call   8010834b <deallocuvm>
  for(i = 0; i < NPDENTRIES; i++){
8010843a:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
80108441:	eb 48                	jmp    8010848b <freevm+0x84>
    if(pgdir[i] & PTE_P){
80108443:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108446:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
8010844d:	8b 45 08             	mov    0x8(%ebp),%eax
80108450:	01 d0                	add    %edx,%eax
80108452:	8b 00                	mov    (%eax),%eax
80108454:	83 e0 01             	and    $0x1,%eax
80108457:	85 c0                	test   %eax,%eax
80108459:	74 2c                	je     80108487 <freevm+0x80>
      char * v = p2v(PTE_ADDR(pgdir[i]));
8010845b:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010845e:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
80108465:	8b 45 08             	mov    0x8(%ebp),%eax
80108468:	01 d0                	add    %edx,%eax
8010846a:	8b 00                	mov    (%eax),%eax
8010846c:	25 00 f0 ff ff       	and    $0xfffff000,%eax
80108471:	89 04 24             	mov    %eax,(%esp)
80108474:	e8 6b f4 ff ff       	call   801078e4 <p2v>
80108479:	89 45 f0             	mov    %eax,-0x10(%ebp)
      kfree(v);
8010847c:	8b 45 f0             	mov    -0x10(%ebp),%eax
8010847f:	89 04 24             	mov    %eax,(%esp)
80108482:	e8 2b a6 ff ff       	call   80102ab2 <kfree>
  uint i;

  if(pgdir == 0)
    panic("freevm: no pgdir");
  deallocuvm(pgdir, KERNBASE, 0);
  for(i = 0; i < NPDENTRIES; i++){
80108487:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
8010848b:	81 7d f4 ff 03 00 00 	cmpl   $0x3ff,-0xc(%ebp)
80108492:	76 af                	jbe    80108443 <freevm+0x3c>
    if(pgdir[i] & PTE_P){
      char * v = p2v(PTE_ADDR(pgdir[i]));
      kfree(v);
    }
  }
  kfree((char*)pgdir);
80108494:	8b 45 08             	mov    0x8(%ebp),%eax
80108497:	89 04 24             	mov    %eax,(%esp)
8010849a:	e8 13 a6 ff ff       	call   80102ab2 <kfree>
}
8010849f:	c9                   	leave  
801084a0:	c3                   	ret    

801084a1 <clearpteu>:

// Clear PTE_U on a page. Used to create an inaccessible
// page beneath the user stack.
void
clearpteu(pde_t *pgdir, char *uva)
{
801084a1:	55                   	push   %ebp
801084a2:	89 e5                	mov    %esp,%ebp
801084a4:	83 ec 28             	sub    $0x28,%esp
  pte_t *pte;

  pte = walkpgdir(pgdir, uva, 0);
801084a7:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
801084ae:	00 
801084af:	8b 45 0c             	mov    0xc(%ebp),%eax
801084b2:	89 44 24 04          	mov    %eax,0x4(%esp)
801084b6:	8b 45 08             	mov    0x8(%ebp),%eax
801084b9:	89 04 24             	mov    %eax,(%esp)
801084bc:	e8 a6 f8 ff ff       	call   80107d67 <walkpgdir>
801084c1:	89 45 f4             	mov    %eax,-0xc(%ebp)
  if(pte == 0)
801084c4:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
801084c8:	75 0c                	jne    801084d6 <clearpteu+0x35>
    panic("clearpteu");
801084ca:	c7 04 24 6c 8d 10 80 	movl   $0x80108d6c,(%esp)
801084d1:	e8 70 80 ff ff       	call   80100546 <panic>
  *pte &= ~PTE_U;
801084d6:	8b 45 f4             	mov    -0xc(%ebp),%eax
801084d9:	8b 00                	mov    (%eax),%eax
801084db:	89 c2                	mov    %eax,%edx
801084dd:	83 e2 fb             	and    $0xfffffffb,%edx
801084e0:	8b 45 f4             	mov    -0xc(%ebp),%eax
801084e3:	89 10                	mov    %edx,(%eax)
}
801084e5:	c9                   	leave  
801084e6:	c3                   	ret    

801084e7 <copyuvm>:

// Given a parent process's page table, create a copy
// of it for a child.
pde_t*
copyuvm(pde_t *pgdir, uint sz)
{
801084e7:	55                   	push   %ebp
801084e8:	89 e5                	mov    %esp,%ebp
801084ea:	83 ec 48             	sub    $0x48,%esp
  pde_t *d;
  pte_t *pte;
  uint pa, i;
  char *mem;

  if((d = setupkvm()) == 0)
801084ed:	e8 ad f9 ff ff       	call   80107e9f <setupkvm>
801084f2:	89 45 f0             	mov    %eax,-0x10(%ebp)
801084f5:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
801084f9:	75 0a                	jne    80108505 <copyuvm+0x1e>
    return 0;
801084fb:	b8 00 00 00 00       	mov    $0x0,%eax
80108500:	e9 f1 00 00 00       	jmp    801085f6 <copyuvm+0x10f>
  for(i = 0; i < sz; i += PGSIZE){
80108505:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
8010850c:	e9 c0 00 00 00       	jmp    801085d1 <copyuvm+0xea>
    if((pte = walkpgdir(pgdir, (void *) i, 0)) == 0)
80108511:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108514:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
8010851b:	00 
8010851c:	89 44 24 04          	mov    %eax,0x4(%esp)
80108520:	8b 45 08             	mov    0x8(%ebp),%eax
80108523:	89 04 24             	mov    %eax,(%esp)
80108526:	e8 3c f8 ff ff       	call   80107d67 <walkpgdir>
8010852b:	89 45 ec             	mov    %eax,-0x14(%ebp)
8010852e:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
80108532:	75 0c                	jne    80108540 <copyuvm+0x59>
      panic("copyuvm: pte should exist");
80108534:	c7 04 24 76 8d 10 80 	movl   $0x80108d76,(%esp)
8010853b:	e8 06 80 ff ff       	call   80100546 <panic>
    if(!(*pte & PTE_P))
80108540:	8b 45 ec             	mov    -0x14(%ebp),%eax
80108543:	8b 00                	mov    (%eax),%eax
80108545:	83 e0 01             	and    $0x1,%eax
80108548:	85 c0                	test   %eax,%eax
8010854a:	75 0c                	jne    80108558 <copyuvm+0x71>
      panic("copyuvm: page not present");
8010854c:	c7 04 24 90 8d 10 80 	movl   $0x80108d90,(%esp)
80108553:	e8 ee 7f ff ff       	call   80100546 <panic>
    pa = PTE_ADDR(*pte);
80108558:	8b 45 ec             	mov    -0x14(%ebp),%eax
8010855b:	8b 00                	mov    (%eax),%eax
8010855d:	25 00 f0 ff ff       	and    $0xfffff000,%eax
80108562:	89 45 e8             	mov    %eax,-0x18(%ebp)
    if((mem = kalloc()) == 0)
80108565:	e8 e1 a5 ff ff       	call   80102b4b <kalloc>
8010856a:	89 45 e4             	mov    %eax,-0x1c(%ebp)
8010856d:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
80108571:	74 6f                	je     801085e2 <copyuvm+0xfb>
      goto bad;
    memmove(mem, (char*)p2v(pa), PGSIZE);
80108573:	8b 45 e8             	mov    -0x18(%ebp),%eax
80108576:	89 04 24             	mov    %eax,(%esp)
80108579:	e8 66 f3 ff ff       	call   801078e4 <p2v>
8010857e:	c7 44 24 08 00 10 00 	movl   $0x1000,0x8(%esp)
80108585:	00 
80108586:	89 44 24 04          	mov    %eax,0x4(%esp)
8010858a:	8b 45 e4             	mov    -0x1c(%ebp),%eax
8010858d:	89 04 24             	mov    %eax,(%esp)
80108590:	e8 b0 cd ff ff       	call   80105345 <memmove>
    if(mappages(d, (void*)i, PGSIZE, v2p(mem), PTE_W|PTE_U) < 0)
80108595:	8b 45 e4             	mov    -0x1c(%ebp),%eax
80108598:	89 04 24             	mov    %eax,(%esp)
8010859b:	e8 37 f3 ff ff       	call   801078d7 <v2p>
801085a0:	8b 55 f4             	mov    -0xc(%ebp),%edx
801085a3:	c7 44 24 10 06 00 00 	movl   $0x6,0x10(%esp)
801085aa:	00 
801085ab:	89 44 24 0c          	mov    %eax,0xc(%esp)
801085af:	c7 44 24 08 00 10 00 	movl   $0x1000,0x8(%esp)
801085b6:	00 
801085b7:	89 54 24 04          	mov    %edx,0x4(%esp)
801085bb:	8b 45 f0             	mov    -0x10(%ebp),%eax
801085be:	89 04 24             	mov    %eax,(%esp)
801085c1:	e8 43 f8 ff ff       	call   80107e09 <mappages>
801085c6:	85 c0                	test   %eax,%eax
801085c8:	78 1b                	js     801085e5 <copyuvm+0xfe>
  uint pa, i;
  char *mem;

  if((d = setupkvm()) == 0)
    return 0;
  for(i = 0; i < sz; i += PGSIZE){
801085ca:	81 45 f4 00 10 00 00 	addl   $0x1000,-0xc(%ebp)
801085d1:	8b 45 f4             	mov    -0xc(%ebp),%eax
801085d4:	3b 45 0c             	cmp    0xc(%ebp),%eax
801085d7:	0f 82 34 ff ff ff    	jb     80108511 <copyuvm+0x2a>
      goto bad;
    memmove(mem, (char*)p2v(pa), PGSIZE);
    if(mappages(d, (void*)i, PGSIZE, v2p(mem), PTE_W|PTE_U) < 0)
      goto bad;
  }
  return d;
801085dd:	8b 45 f0             	mov    -0x10(%ebp),%eax
801085e0:	eb 14                	jmp    801085f6 <copyuvm+0x10f>
      panic("copyuvm: pte should exist");
    if(!(*pte & PTE_P))
      panic("copyuvm: page not present");
    pa = PTE_ADDR(*pte);
    if((mem = kalloc()) == 0)
      goto bad;
801085e2:	90                   	nop
801085e3:	eb 01                	jmp    801085e6 <copyuvm+0xff>
    memmove(mem, (char*)p2v(pa), PGSIZE);
    if(mappages(d, (void*)i, PGSIZE, v2p(mem), PTE_W|PTE_U) < 0)
      goto bad;
801085e5:	90                   	nop
  }
  return d;

bad:
  freevm(d);
801085e6:	8b 45 f0             	mov    -0x10(%ebp),%eax
801085e9:	89 04 24             	mov    %eax,(%esp)
801085ec:	e8 16 fe ff ff       	call   80108407 <freevm>
  return 0;
801085f1:	b8 00 00 00 00       	mov    $0x0,%eax
}
801085f6:	c9                   	leave  
801085f7:	c3                   	ret    

801085f8 <uva2ka>:

//PAGEBREAK!
// Map user virtual address to kernel address.
char*
uva2ka(pde_t *pgdir, char *uva)
{
801085f8:	55                   	push   %ebp
801085f9:	89 e5                	mov    %esp,%ebp
801085fb:	83 ec 28             	sub    $0x28,%esp
  pte_t *pte;

  pte = walkpgdir(pgdir, uva, 0);
801085fe:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
80108605:	00 
80108606:	8b 45 0c             	mov    0xc(%ebp),%eax
80108609:	89 44 24 04          	mov    %eax,0x4(%esp)
8010860d:	8b 45 08             	mov    0x8(%ebp),%eax
80108610:	89 04 24             	mov    %eax,(%esp)
80108613:	e8 4f f7 ff ff       	call   80107d67 <walkpgdir>
80108618:	89 45 f4             	mov    %eax,-0xc(%ebp)
  if((*pte & PTE_P) == 0)
8010861b:	8b 45 f4             	mov    -0xc(%ebp),%eax
8010861e:	8b 00                	mov    (%eax),%eax
80108620:	83 e0 01             	and    $0x1,%eax
80108623:	85 c0                	test   %eax,%eax
80108625:	75 07                	jne    8010862e <uva2ka+0x36>
    return 0;
80108627:	b8 00 00 00 00       	mov    $0x0,%eax
8010862c:	eb 25                	jmp    80108653 <uva2ka+0x5b>
  if((*pte & PTE_U) == 0)
8010862e:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108631:	8b 00                	mov    (%eax),%eax
80108633:	83 e0 04             	and    $0x4,%eax
80108636:	85 c0                	test   %eax,%eax
80108638:	75 07                	jne    80108641 <uva2ka+0x49>
    return 0;
8010863a:	b8 00 00 00 00       	mov    $0x0,%eax
8010863f:	eb 12                	jmp    80108653 <uva2ka+0x5b>
  return (char*)p2v(PTE_ADDR(*pte));
80108641:	8b 45 f4             	mov    -0xc(%ebp),%eax
80108644:	8b 00                	mov    (%eax),%eax
80108646:	25 00 f0 ff ff       	and    $0xfffff000,%eax
8010864b:	89 04 24             	mov    %eax,(%esp)
8010864e:	e8 91 f2 ff ff       	call   801078e4 <p2v>
}
80108653:	c9                   	leave  
80108654:	c3                   	ret    

80108655 <copyout>:
// Copy len bytes from p to user address va in page table pgdir.
// Most useful when pgdir is not the current page table.
// uva2ka ensures this only works for PTE_U pages.
int
copyout(pde_t *pgdir, uint va, void *p, uint len)
{
80108655:	55                   	push   %ebp
80108656:	89 e5                	mov    %esp,%ebp
80108658:	83 ec 28             	sub    $0x28,%esp
  char *buf, *pa0;
  uint n, va0;

  buf = (char*)p;
8010865b:	8b 45 10             	mov    0x10(%ebp),%eax
8010865e:	89 45 f4             	mov    %eax,-0xc(%ebp)
  while(len > 0){
80108661:	e9 89 00 00 00       	jmp    801086ef <copyout+0x9a>
    va0 = (uint)PGROUNDDOWN(va);
80108666:	8b 45 0c             	mov    0xc(%ebp),%eax
80108669:	25 00 f0 ff ff       	and    $0xfffff000,%eax
8010866e:	89 45 ec             	mov    %eax,-0x14(%ebp)
    pa0 = uva2ka(pgdir, (char*)va0);
80108671:	8b 45 ec             	mov    -0x14(%ebp),%eax
80108674:	89 44 24 04          	mov    %eax,0x4(%esp)
80108678:	8b 45 08             	mov    0x8(%ebp),%eax
8010867b:	89 04 24             	mov    %eax,(%esp)
8010867e:	e8 75 ff ff ff       	call   801085f8 <uva2ka>
80108683:	89 45 e8             	mov    %eax,-0x18(%ebp)
    if(pa0 == 0)
80108686:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
8010868a:	75 07                	jne    80108693 <copyout+0x3e>
      return -1;
8010868c:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
80108691:	eb 6b                	jmp    801086fe <copyout+0xa9>
    n = PGSIZE - (va - va0);
80108693:	8b 45 0c             	mov    0xc(%ebp),%eax
80108696:	8b 55 ec             	mov    -0x14(%ebp),%edx
80108699:	89 d1                	mov    %edx,%ecx
8010869b:	29 c1                	sub    %eax,%ecx
8010869d:	89 c8                	mov    %ecx,%eax
8010869f:	05 00 10 00 00       	add    $0x1000,%eax
801086a4:	89 45 f0             	mov    %eax,-0x10(%ebp)
    if(n > len)
801086a7:	8b 45 f0             	mov    -0x10(%ebp),%eax
801086aa:	3b 45 14             	cmp    0x14(%ebp),%eax
801086ad:	76 06                	jbe    801086b5 <copyout+0x60>
      n = len;
801086af:	8b 45 14             	mov    0x14(%ebp),%eax
801086b2:	89 45 f0             	mov    %eax,-0x10(%ebp)
    memmove(pa0 + (va - va0), buf, n);
801086b5:	8b 45 ec             	mov    -0x14(%ebp),%eax
801086b8:	8b 55 0c             	mov    0xc(%ebp),%edx
801086bb:	29 c2                	sub    %eax,%edx
801086bd:	8b 45 e8             	mov    -0x18(%ebp),%eax
801086c0:	01 c2                	add    %eax,%edx
801086c2:	8b 45 f0             	mov    -0x10(%ebp),%eax
801086c5:	89 44 24 08          	mov    %eax,0x8(%esp)
801086c9:	8b 45 f4             	mov    -0xc(%ebp),%eax
801086cc:	89 44 24 04          	mov    %eax,0x4(%esp)
801086d0:	89 14 24             	mov    %edx,(%esp)
801086d3:	e8 6d cc ff ff       	call   80105345 <memmove>
    len -= n;
801086d8:	8b 45 f0             	mov    -0x10(%ebp),%eax
801086db:	29 45 14             	sub    %eax,0x14(%ebp)
    buf += n;
801086de:	8b 45 f0             	mov    -0x10(%ebp),%eax
801086e1:	01 45 f4             	add    %eax,-0xc(%ebp)
    va = va0 + PGSIZE;
801086e4:	8b 45 ec             	mov    -0x14(%ebp),%eax
801086e7:	05 00 10 00 00       	add    $0x1000,%eax
801086ec:	89 45 0c             	mov    %eax,0xc(%ebp)
{
  char *buf, *pa0;
  uint n, va0;

  buf = (char*)p;
  while(len > 0){
801086ef:	83 7d 14 00          	cmpl   $0x0,0x14(%ebp)
801086f3:	0f 85 6d ff ff ff    	jne    80108666 <copyout+0x11>
    memmove(pa0 + (va - va0), buf, n);
    len -= n;
    buf += n;
    va = va0 + PGSIZE;
  }
  return 0;
801086f9:	b8 00 00 00 00       	mov    $0x0,%eax
}
801086fe:	c9                   	leave  
801086ff:	c3                   	ret    
